[dpdk-stable] patch 'eal: fix out of bound access when no CPU available' has been queued to LTS release 17.11.6

Yongseok Koh yskoh at mellanox.com
Fri Mar 8 18:47:26 CET 2019


Hi,

FYI, your patch has been queued to LTS release 17.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objection by 03/13/19. So please
shout if anyone has objection.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Yongseok

---
>From f22a700d2f3638f0c9c70e4ca300e21b6d3c03db Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Thu, 17 Jan 2019 14:12:57 +0100
Subject: [PATCH] eal: fix out of bound access when no CPU available

[ upstream commit 7b55015e1487a5f407a760cfb4d9dbf1ddacd0cc ]

In the unlikely case when the dpdk application is started with no cpu
available in the [0, RTE_MAX_LCORE - 1] range, the master_lcore is
automatically chosen as RTE_MAX_LCORE which triggers an out of bound
access.

Either you have a crash then, or the initialisation fails later when
trying to pin the master thread on it.
In my test, with RTE_MAX_LCORE == 2:

$ taskset -c 2 ./master/app/testpmd --no-huge -m 512 --log-level *:debug
[...]
EAL: pthread_setaffinity_np failed
PANIC in eal_thread_init_master():
cannot set affinity
7: [./master/app/testpmd() [0x47f629]]

Bugzilla ID: 19
Fixes: 2eba8d21f3c9 ("eal: restrict cores auto detection")

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 lib/librte_eal/common/eal_common_options.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index dd446a5ad..d91104dc0 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -1215,6 +1215,8 @@ eal_adjust_config(struct internal_config *internal_cfg)
 	/* default master lcore is the first one */
 	if (!master_lcore_parsed) {
 		cfg->master_lcore = rte_get_next_lcore(-1, 0, 0);
+		if (cfg->master_lcore >= RTE_MAX_LCORE)
+			return -1;
 		lcore_config[cfg->master_lcore].core_role = ROLE_RTE;
 	}
 
-- 
2.11.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-03-08 09:46:42.607514571 -0800
+++ 0048-eal-fix-out-of-bound-access-when-no-CPU-available.patch	2019-03-08 09:46:40.237401000 -0800
@@ -1,8 +1,10 @@
-From 7b55015e1487a5f407a760cfb4d9dbf1ddacd0cc Mon Sep 17 00:00:00 2001
+From f22a700d2f3638f0c9c70e4ca300e21b6d3c03db Mon Sep 17 00:00:00 2001
 From: David Marchand <david.marchand at redhat.com>
 Date: Thu, 17 Jan 2019 14:12:57 +0100
 Subject: [PATCH] eal: fix out of bound access when no CPU available
 
+[ upstream commit 7b55015e1487a5f407a760cfb4d9dbf1ddacd0cc ]
+
 In the unlikely case when the dpdk application is started with no cpu
 available in the [0, RTE_MAX_LCORE - 1] range, the master_lcore is
 automatically chosen as RTE_MAX_LCORE which triggers an out of bound
@@ -21,7 +23,6 @@
 
 Bugzilla ID: 19
 Fixes: 2eba8d21f3c9 ("eal: restrict cores auto detection")
-Cc: stable at dpdk.org
 
 Signed-off-by: David Marchand <david.marchand at redhat.com>
 ---
@@ -29,10 +30,10 @@
  1 file changed, 2 insertions(+)
 
 diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
-index 4681333ed..80d790292 100644
+index dd446a5ad..d91104dc0 100644
 --- a/lib/librte_eal/common/eal_common_options.c
 +++ b/lib/librte_eal/common/eal_common_options.c
-@@ -1388,6 +1388,8 @@ eal_adjust_config(struct internal_config *internal_cfg)
+@@ -1215,6 +1215,8 @@ eal_adjust_config(struct internal_config *internal_cfg)
  	/* default master lcore is the first one */
  	if (!master_lcore_parsed) {
  		cfg->master_lcore = rte_get_next_lcore(-1, 0, 0);


More information about the stable mailing list