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

Kevin Traynor ktraynor at redhat.com
Thu Feb 7 14:25:21 CET 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/14/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Kevin Traynor

---
>From 508dc0617a6874784f9fa5ac5c5552bce82ae9de 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 ca5a4e332..02eb18410 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -1388,4 +1388,6 @@ eal_adjust_config(struct internal_config *internal_cfg)
 	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.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-02-07 13:19:55.873553342 +0000
+++ 0015-eal-fix-out-of-bound-access-when-no-CPU-available.patch	2019-02-07 13:19:55.000000000 +0000
@@ -1,8 +1,10 @@
-From 7b55015e1487a5f407a760cfb4d9dbf1ddacd0cc Mon Sep 17 00:00:00 2001
+From 508dc0617a6874784f9fa5ac5c5552bce82ae9de 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 ca5a4e332..02eb18410 100644
 --- a/lib/librte_eal/common/eal_common_options.c
 +++ b/lib/librte_eal/common/eal_common_options.c
-@@ -1389,4 +1389,6 @@ eal_adjust_config(struct internal_config *internal_cfg)
+@@ -1388,4 +1388,6 @@ eal_adjust_config(struct internal_config *internal_cfg)
  	if (!master_lcore_parsed) {
  		cfg->master_lcore = rte_get_next_lcore(-1, 0, 0);
 +		if (cfg->master_lcore >= RTE_MAX_LCORE)


More information about the stable mailing list