* [dpdk-dev] [PATCH] lib/table: fix table autotest ut crashes in ipv6
@ 2019-07-02 11:21 Jananee Parthasarathy
2019-07-02 11:46 ` David Marchand
0 siblings, 1 reply; 4+ messages in thread
From: Jananee Parthasarathy @ 2019-07-02 11:21 UTC (permalink / raw)
To: dev
Cc: reshma.pattan, david.marchand, cristian.dumitrescu,
jasvinder.singh, Jananee Parthasarathy, stable
Unit test table_autotest results in segmentation fault.
Crash occurs in test_table_lpm_ipv6_combined().
Variable 'nht_pos0' used as array subscript is not initialized
in rte_table_lpm_ipv6_entry_add(). It will not be assigned,
if a rule does not exist.
In such case a junk number or invalid array index might result in
segmentation fault due to array out of bounds when
lpm->nht_users is used with such invalid array index.
Fix is to initialize the variables used for array subscript.
Fixes: d89a5bce1d ("lpm6: extend next hop field")
Cc: stable@dpdk.org
Signed-off-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
---
lib/librte_table/rte_table_lpm_ipv6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c
index a55f808a4..4e068d79b 100644
--- a/lib/librte_table/rte_table_lpm_ipv6.c
+++ b/lib/librte_table/rte_table_lpm_ipv6.c
@@ -182,7 +182,7 @@ rte_table_lpm_ipv6_entry_add(
struct rte_table_lpm_ipv6 *lpm = table;
struct rte_table_lpm_ipv6_key *ip_prefix =
key;
- uint32_t nht_pos, nht_pos0, nht_pos0_valid;
+ uint32_t nht_pos = 0, nht_pos0 = 0, nht_pos0_valid = 0;
int status;
/* Check input parameters */
--
2.14.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] lib/table: fix table autotest ut crashes in ipv6
2019-07-02 11:21 [dpdk-dev] [PATCH] lib/table: fix table autotest ut crashes in ipv6 Jananee Parthasarathy
@ 2019-07-02 11:46 ` David Marchand
2019-07-02 11:50 ` Dumitrescu, Cristian
0 siblings, 1 reply; 4+ messages in thread
From: David Marchand @ 2019-07-02 11:46 UTC (permalink / raw)
To: Jananee Parthasarathy
Cc: dev, Pattan, Reshma, Cristian Dumitrescu, Singh, Jasvinder, dpdk stable
On Tue, Jul 2, 2019 at 1:22 PM Jananee Parthasarathy <
jananeex.m.parthasarathy@intel.com> wrote:
> Unit test table_autotest results in segmentation fault.
> Crash occurs in test_table_lpm_ipv6_combined().
>
> Variable 'nht_pos0' used as array subscript is not initialized
> in rte_table_lpm_ipv6_entry_add(). It will not be assigned,
> if a rule does not exist.
>
> In such case a junk number or invalid array index might result in
> segmentation fault due to array out of bounds when
> lpm->nht_users is used with such invalid array index.
>
> Fix is to initialize the variables used for array subscript.
>
>
Bugzilla ID: 285
Fixes: d89a5bce1d ("lpm6: extend next hop field")
> Cc: stable@dpdk.org
>
> Signed-off-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
> ---
> lib/librte_table/rte_table_lpm_ipv6.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_table/rte_table_lpm_ipv6.c
> b/lib/librte_table/rte_table_lpm_ipv6.c
> index a55f808a4..4e068d79b 100644
> --- a/lib/librte_table/rte_table_lpm_ipv6.c
> +++ b/lib/librte_table/rte_table_lpm_ipv6.c
> @@ -182,7 +182,7 @@ rte_table_lpm_ipv6_entry_add(
> struct rte_table_lpm_ipv6 *lpm = table;
> struct rte_table_lpm_ipv6_key *ip_prefix =
> key;
> - uint32_t nht_pos, nht_pos0, nht_pos0_valid;
> + uint32_t nht_pos = 0, nht_pos0 = 0, nht_pos0_valid = 0;
>
nht_pos_valid is unconditionnally set, no need to initialize.
Just noticed that nht_pos is not initialised to 0 in ipv4 code.
It fixes the segfault I saw, leaving the ack to the maintainer.
Tested-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] lib/table: fix table autotest ut crashes in ipv6
2019-07-02 11:46 ` David Marchand
@ 2019-07-02 11:50 ` Dumitrescu, Cristian
2019-07-04 21:25 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Dumitrescu, Cristian @ 2019-07-02 11:50 UTC (permalink / raw)
To: David Marchand, Parthasarathy, JananeeX M
Cc: dev, Pattan, Reshma, Singh, Jasvinder, dpdk stable
From: David Marchand [mailto:david.marchand@redhat.com]
Sent: Tuesday, July 2, 2019 12:46 PM
To: Parthasarathy, JananeeX M <jananeex.m.parthasarathy@intel.com>
Cc: dev <dev@dpdk.org>; Pattan, Reshma <reshma.pattan@intel.com>; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder <jasvinder.singh@intel.com>; dpdk stable <stable@dpdk.org>
Subject: Re: [PATCH] lib/table: fix table autotest ut crashes in ipv6
On Tue, Jul 2, 2019 at 1:22 PM Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com<mailto:jananeex.m.parthasarathy@intel.com>> wrote:
Unit test table_autotest results in segmentation fault.
Crash occurs in test_table_lpm_ipv6_combined().
Variable 'nht_pos0' used as array subscript is not initialized
in rte_table_lpm_ipv6_entry_add(). It will not be assigned,
if a rule does not exist.
In such case a junk number or invalid array index might result in
segmentation fault due to array out of bounds when
lpm->nht_users is used with such invalid array index.
Fix is to initialize the variables used for array subscript.
Bugzilla ID: 285
Fixes: d89a5bce1d ("lpm6: extend next hop field")
Cc: stable@dpdk.org<mailto:stable@dpdk.org>
Signed-off-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com<mailto:jananeex.m.parthasarathy@intel.com>>
---
lib/librte_table/rte_table_lpm_ipv6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c
index a55f808a4..4e068d79b 100644
--- a/lib/librte_table/rte_table_lpm_ipv6.c
+++ b/lib/librte_table/rte_table_lpm_ipv6.c
@@ -182,7 +182,7 @@ rte_table_lpm_ipv6_entry_add(
struct rte_table_lpm_ipv6 *lpm = table;
struct rte_table_lpm_ipv6_key *ip_prefix =
key;
- uint32_t nht_pos, nht_pos0, nht_pos0_valid;
+ uint32_t nht_pos = 0, nht_pos0 = 0, nht_pos0_valid = 0;
nht_pos_valid is unconditionnally set, no need to initialize.
Just noticed that nht_pos is not initialised to 0 in ipv4 code.
It fixes the segfault I saw, leaving the ack to the maintainer.
Tested-by: David Marchand <david.marchand@redhat.com<mailto:david.marchand@redhat.com>>
--
David Marchand
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] lib/table: fix table autotest ut crashes in ipv6
2019-07-02 11:50 ` Dumitrescu, Cristian
@ 2019-07-04 21:25 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2019-07-04 21:25 UTC (permalink / raw)
To: Parthasarathy, JananeeX M
Cc: stable, Dumitrescu, Cristian, David Marchand, dev, Pattan,
Reshma, Singh, Jasvinder
02/07/2019 13:50, Dumitrescu, Cristian:
> From: David Marchand [mailto:david.marchand@redhat.com]
> On Tue, Jul 2, 2019 at 1:22 PM Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com<mailto:jananeex.m.parthasarathy@intel.com>> wrote:
> Unit test table_autotest results in segmentation fault.
> Crash occurs in test_table_lpm_ipv6_combined().
>
> Variable 'nht_pos0' used as array subscript is not initialized
> in rte_table_lpm_ipv6_entry_add(). It will not be assigned,
> if a rule does not exist.
>
> In such case a junk number or invalid array index might result in
> segmentation fault due to array out of bounds when
> lpm->nht_users is used with such invalid array index.
>
> Fix is to initialize the variables used for array subscript.
>
> Bugzilla ID: 285
>
> Fixes: d89a5bce1d ("lpm6: extend next hop field")
> Cc: stable@dpdk.org<mailto:stable@dpdk.org>
>
> Signed-off-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com<mailto:jananeex.m.parthasarathy@intel.com>>
[...]
> It fixes the segfault I saw, leaving the ack to the maintainer.
> Tested-by: David Marchand <david.marchand@redhat.com<mailto:david.marchand@redhat.com>>
>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-04 21:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 11:21 [dpdk-dev] [PATCH] lib/table: fix table autotest ut crashes in ipv6 Jananee Parthasarathy
2019-07-02 11:46 ` David Marchand
2019-07-02 11:50 ` Dumitrescu, Cristian
2019-07-04 21:25 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).