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 DCA361B488 for ; Thu, 22 Nov 2018 17:52:00 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B1B53154872; Thu, 22 Nov 2018 16:52:00 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id B305660E3F; Thu, 22 Nov 2018 16:51:58 +0000 (UTC) From: Kevin Traynor To: Dariusz Stojaczyk Cc: Anatoly Burakov , dpdk stable Date: Thu, 22 Nov 2018 16:49:13 +0000 Message-Id: <20181122164957.13003-21-ktraynor@redhat.com> In-Reply-To: <20181122164957.13003-1-ktraynor@redhat.com> References: <20181122164957.13003-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 22 Nov 2018 16:52:00 +0000 (UTC) Subject: [dpdk-stable] patch 'ipc: fix undefined behavior in no-shconf mode' has been queued to stable release 18.08.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, 22 Nov 2018 16:52:01 -0000 Hi, FYI, your patch has been queued to stable release 18.08.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 11/28/18. 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. 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. Kevin Traynor --- >>From a716b9ffcbc8a42178c42b29d38dcdfcf706994c Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Wed, 24 Oct 2018 12:05:17 +0200 Subject: [PATCH] ipc: fix undefined behavior in no-shconf mode [ upstream commit b4f62e586279bd5c49933f0e873adf047847e556 ] In no-shconf mode the rte_mp_request_sync() wasn't initializing the `reply` parameter, which contained e.g. a number of sent requests. Callers of rte_mp_request_sync() might check that param afterwards and might read potentially unitialized memory. The no-shconf check that makes us return early (with rc = 0) was placed before the `reply` initialization. Fix this by making the `reply` initialization occur first. Fixes: 5848e3d2813c ("ipc: support --no-shconf mode") Signed-off-by: Dariusz Stojaczyk Acked-by: Anatoly Burakov --- lib/librte_eal/common/eal_common_proc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index 9fcb91219..97663d3ba 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -940,4 +940,8 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, return -1; + reply->nb_sent = 0; + reply->nb_received = 0; + reply->msgs = NULL; + if (internal_config.no_shconf) { RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n"); @@ -946,5 +950,5 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, if (gettimeofday(&now, NULL) < 0) { - RTE_LOG(ERR, EAL, "Faile to get current time\n"); + RTE_LOG(ERR, EAL, "Failed to get current time\n"); rte_errno = errno; return -1; @@ -955,8 +959,4 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, (now.tv_usec * 1000 + ts->tv_nsec) / 1000000000; - reply->nb_sent = 0; - reply->nb_received = 0; - reply->msgs = NULL; - /* for secondary process, send request to the primary process only */ if (rte_eal_process_type() == RTE_PROC_SECONDARY) { -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-22 16:47:32.818565256 +0000 +++ 0021-ipc-fix-undefined-behavior-in-no-shconf-mode.patch 2018-11-22 16:47:32.000000000 +0000 @@ -1,8 +1,10 @@ -From b4f62e586279bd5c49933f0e873adf047847e556 Mon Sep 17 00:00:00 2001 +From a716b9ffcbc8a42178c42b29d38dcdfcf706994c Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Wed, 24 Oct 2018 12:05:17 +0200 Subject: [PATCH] ipc: fix undefined behavior in no-shconf mode +[ upstream commit b4f62e586279bd5c49933f0e873adf047847e556 ] + In no-shconf mode the rte_mp_request_sync() wasn't initializing the `reply` parameter, which contained e.g. a number of sent requests. Callers of rte_mp_request_sync() might check that @@ -13,7 +15,6 @@ `reply` initialization occur first. Fixes: 5848e3d2813c ("ipc: support --no-shconf mode") -Cc: stable@dpdk.org Signed-off-by: Dariusz Stojaczyk Acked-by: Anatoly Burakov