From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 99ACC1B3B5 for ; Thu, 7 Feb 2019 14:27:33 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 942CFA0B58 for ; Thu, 7 Feb 2019 13:27:32 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.33.36.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF96319CB6; Thu, 7 Feb 2019 13:27:28 +0000 (UTC) From: Kevin Traynor To: David Marchand Cc: dpdk stable Date: Thu, 7 Feb 2019 13:25:21 +0000 Message-Id: <20190207132614.20538-15-ktraynor@redhat.com> In-Reply-To: <20190207132614.20538-1-ktraynor@redhat.com> References: <20190207132614.20538-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 07 Feb 2019 13:27:32 +0000 (UTC) Subject: [dpdk-stable] patch 'eal: fix out of bound access when no CPU available' has been queued to LTS release 18.11.1 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: Thu, 07 Feb 2019 13:27:34 -0000 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 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 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 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 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)