From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 85E792BA5 for ; Fri, 8 Mar 2019 18:49:12 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 8 Mar 2019 19:49:11 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x28HloB4002625; Fri, 8 Mar 2019 19:49:10 +0200 From: Yongseok Koh To: David Marchand Cc: dpdk stable Date: Fri, 8 Mar 2019 09:47:26 -0800 Message-Id: <20190308174749.30771-48-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190308174749.30771-1-yskoh@mellanox.com> References: <20190308174749.30771-1-yskoh@mellanox.com> Subject: [dpdk-stable] patch 'eal: fix out of bound access when no CPU available' has been queued to LTS release 17.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2019 17:49:12 -0000 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 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 --- 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 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@dpdk.org Signed-off-by: David Marchand --- @@ -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);