Bugzilla ID: 296
the size of counters array in mlx5_xstats_get() was smaller
than the memory we are setting for this array in
mlx5_os_read_dev_counters(). due to which the extra memory is
corrupted and thus corrupting the seemingly unrelated variables.
this happens at the first run only because the n function arg
of mlx5_xstats_get() which is used to init counters array is
initialized by adding the preceding statistics which in our case
(i.e first run) is zero. after the initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from
then onward the counters array size is correct
my changes will only affect the flow of the first run when we
need to initialize stats in mlx5_os_stats_init(). the size of the
counters array is set according the mlx5_stats_n variable. by doing
this we will avoid the memset corrupting other variables` memory
Signed-off-by: huzaifa.rahman <redacted>
---
drivers/net/mlx5/mlx5_stats.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Bugzilla ID: 296
the size of counters array in mlx5_xstats_get() was smaller
than the memory we are setting for this array in
mlx5_os_read_dev_counters(). due to which the extra memory is
corrupted and thus corrupting the seemingly unrelated variables.
this happens at the first run only because the n function arg
of mlx5_xstats_get() which is used to init counters array is
initialized by adding the preceding statistics which in our case
(i.e first run) is zero. after the initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from
then onward the counters array size is correct
my changes will only affect the flow of the first run when we
need to initialize stats in mlx5_os_stats_init(). the size of the
counters array is set according the mlx5_stats_n variable. by doing
this we will avoid the memset corrupting other variables` memory
Signed-off-by: huzaifa.rahman<redacted>
On 8/18/22 14:30, huzaifa.rahman wrote:
Bugzilla ID: 296
the size of counters array in mlx5_xstats_get() was smaller
than the memory we are setting for this array in
mlx5_os_read_dev_counters(). due to which the extra memory is
corrupted and thus corrupting the seemingly unrelated variables.
this happens at the first run only because the n function arg
of mlx5_xstats_get() which is used to init counters array is
initialized by adding the preceding statistics which in our case
(i.e first run) is zero. after the initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from
then onward the counters array size is correct
my changes will only affect the flow of the first run when we
need to initialize stats in mlx5_os_stats_init(). the size of the
counters array is set according the mlx5_stats_n variable. by doing
this we will avoid the memset corrupting other variables` memory
Signed-off-by: huzaifa.rahman <redacted> <redacted>
Tested-by: Kamil Vojanec <redacted> <redacted>
Hi,
Is there any other work/changes required for this patch to be submitted?
Thanks
On Thu, Sep 22, 2022 at 3:39 PM Huzaifa Rahman [off-list ref]
wrote:
On 8/18/22 14:30, huzaifa.rahman wrote:
Bugzilla ID: 296
the size of counters array in mlx5_xstats_get() was smaller
than the memory we are setting for this array in
mlx5_os_read_dev_counters(). due to which the extra memory is
corrupted and thus corrupting the seemingly unrelated variables.
this happens at the first run only because the n function arg
of mlx5_xstats_get() which is used to init counters array is
initialized by adding the preceding statistics which in our case
(i.e first run) is zero. after the initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from
then onward the counters array size is correct
my changes will only affect the flow of the first run when we
need to initialize stats in mlx5_os_stats_init(). the size of the
counters array is set according the mlx5_stats_n variable. by doing
this we will avoid the memset corrupting other variables` memory
Signed-off-by: huzaifa.rahman <redacted> <redacted>
Tested-by: Kamil Vojanec <redacted> <redacted>
Hi,
Is there any other work/changes required for this patch to be submitted?
Thanks
On Thu, Sep 22, 2022 at 3:39 PM Huzaifa Rahman[off-list ref]
wrote:
On 8/18/22 14:30, huzaifa.rahman wrote:
Bugzilla ID: 296
the size of counters array in mlx5_xstats_get() was smaller
than the memory we are setting for this array in
mlx5_os_read_dev_counters(). due to which the extra memory is
corrupted and thus corrupting the seemingly unrelated variables.
this happens at the first run only because the n function arg
of mlx5_xstats_get() which is used to init counters array is
initialized by adding the preceding statistics which in our case
(i.e first run) is zero. after the initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from
then onward the counters array size is correct
my changes will only affect the flow of the first run when we
need to initialize stats in mlx5_os_stats_init(). the size of the
counters array is set according the mlx5_stats_n variable. by doing
this we will avoid the memset corrupting other variables` memory
Signed-off-by: huzaifa.rahman<redacted> <redacted>
Tested-by: Kamil Vojanec<redacted> <redacted>
Hi, Huzaifa
Could you, please, format commit message with capitals in the
sentence beginnings? And explanation can be less wordy a little bit.
With best regards,
Slava
quoted hunk
-----Original Message-----
From: huzaifa.rahman <redacted>
Sent: четверг, 18 августа 2022 г. 15:30
To: Matan Azrad <redacted>
Cc: dev@dpdk.org; Slava Ovsiienko <redacted>;
huzaifa.rahman [off-list ref]
Subject: [PATCH] mlx5: initially reading xstats does not cause seg fault
Bugzilla ID: 296
the size of counters array in mlx5_xstats_get() was smaller than the memory
we are setting for this array in mlx5_os_read_dev_counters(). due to which
the extra memory is corrupted and thus corrupting the seemingly unrelated
variables.
this happens at the first run only because the n function arg of
mlx5_xstats_get() which is used to init counters array is initialized by adding
the preceding statistics which in our case (i.e first run) is zero. after the
initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from then
onward the counters array size is correct
my changes will only affect the flow of the first run when we need to initialize
stats in mlx5_os_stats_init(). the size of the counters array is set according the
mlx5_stats_n variable. by doing this we will avoid the memset corrupting
other variables` memory
Signed-off-by: huzaifa.rahman <redacted>
---
drivers/net/mlx5/mlx5_stats.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Hi, Huzaifa
"n" - is the parameter of the mlx5_xstats_get() routine, provided by caller.
We should not change this - it specified the size of "struct rte_eth_xstat *stats " array.
With best regards,
Slava
quoted hunk
-----Original Message-----
From: huzaifa.rahman <redacted>
Sent: четверг, 18 августа 2022 г. 15:30
To: Matan Azrad <redacted>
Cc: dev@dpdk.org; Slava Ovsiienko <redacted>;
huzaifa.rahman [off-list ref]
Subject: [PATCH] mlx5: initially reading xstats does not cause seg fault
Bugzilla ID: 296
the size of counters array in mlx5_xstats_get() was smaller than the memory
we are setting for this array in mlx5_os_read_dev_counters(). due to which
the extra memory is corrupted and thus corrupting the seemingly unrelated
variables.
this happens at the first run only because the n function arg of
mlx5_xstats_get() which is used to init counters array is initialized by adding
the preceding statistics which in our case (i.e first run) is zero. after the
initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from then
onward the counters array size is correct
my changes will only affect the flow of the first run when we need to initialize
stats in mlx5_os_stats_init(). the size of the counters array is set according the
mlx5_stats_n variable. by doing this we will avoid the memset corrupting
other variables` memory
Signed-off-by: huzaifa.rahman <redacted>
---
drivers/net/mlx5/mlx5_stats.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)