patch 'eal/linux: fix illegal memory access in uevent handler' has been queued to stable release 19.11.12

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Wed Mar 9 12:00:59 CET 2022


Hi,

FYI, your patch has been queued to stable release 19.11.12

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/11/22. 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.

Queued patches are on a temporary branch at:
https://github.com/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/1566ae455c008892d65a852f63f044ffe38dc6d8

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 1566ae455c008892d65a852f63f044ffe38dc6d8 Mon Sep 17 00:00:00 2001
From: Steve Yang <stevex.yang at intel.com>
Date: Wed, 23 Feb 2022 08:49:50 +0000
Subject: [PATCH] eal/linux: fix illegal memory access in uevent handler

[ upstream commit 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 ]

'recv()' fills the 'buf', later 'strlcpy()' used to copy from this buffer.
But as coverity warns 'recv()' doesn't guarantee that 'buf' is
null-terminated, but 'strlcpy()' requires it.

Enlarge 'buf' size to 'EAL_UEV_MSG_LEN + 1' and ensure the last one can
be set to 0 when received buffer size is EAL_UEV_MSG_LEN.

CID 375864:  Memory - illegal accesses  (STRING_NULL)
Passing unterminated string "buf" to "dev_uev_parse", which expects
a null-terminated string.

Coverity issue: 375864
Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")

Signed-off-by: Steve Yang <stevex.yang at intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/librte_eal/linux/eal/eal_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linux/eal/eal_dev.c b/lib/librte_eal/linux/eal/eal_dev.c
index 4248f8db5a..eb3e2642e0 100644
--- a/lib/librte_eal/linux/eal/eal_dev.c
+++ b/lib/librte_eal/linux/eal/eal_dev.c
@@ -220,13 +220,13 @@ dev_uev_handler(__rte_unused void *param)
 {
 	struct rte_dev_event uevent;
 	int ret;
-	char buf[EAL_UEV_MSG_LEN];
+	char buf[EAL_UEV_MSG_LEN + 1];
 	struct rte_bus *bus;
 	struct rte_device *dev;
 	const char *busname = "";
 
 	memset(&uevent, 0, sizeof(struct rte_dev_event));
-	memset(buf, 0, EAL_UEV_MSG_LEN);
+	memset(buf, 0, EAL_UEV_MSG_LEN + 1);
 
 	ret = recv(intr_handle.fd, buf, EAL_UEV_MSG_LEN, MSG_DONTWAIT);
 	if (ret < 0 && errno == EAGAIN)
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-09 11:57:44.839486065 +0100
+++ 0028-eal-linux-fix-illegal-memory-access-in-uevent-handle.patch	2022-03-09 11:57:43.396938405 +0100
@@ -1 +1 @@
-From 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 Mon Sep 17 00:00:00 2001
+From 1566ae455c008892d65a852f63f044ffe38dc6d8 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
- lib/eal/linux/eal_dev.c | 4 ++--
+ lib/librte_eal/linux/eal/eal_dev.c | 4 ++--
@@ -27,5 +28,5 @@
-diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
-index f6e5861221..e6f509bcff 100644
---- a/lib/eal/linux/eal_dev.c
-+++ b/lib/eal/linux/eal_dev.c
-@@ -227,13 +227,13 @@ dev_uev_handler(__rte_unused void *param)
+diff --git a/lib/librte_eal/linux/eal/eal_dev.c b/lib/librte_eal/linux/eal/eal_dev.c
+index 4248f8db5a..eb3e2642e0 100644
+--- a/lib/librte_eal/linux/eal/eal_dev.c
++++ b/lib/librte_eal/linux/eal/eal_dev.c
+@@ -220,13 +220,13 @@ dev_uev_handler(__rte_unused void *param)
@@ -45,2 +46,2 @@
- 	if (rte_intr_fd_get(intr_handle) < 0)
- 		return;
+ 	ret = recv(intr_handle.fd, buf, EAL_UEV_MSG_LEN, MSG_DONTWAIT);
+ 	if (ret < 0 && errno == EAGAIN)


More information about the stable mailing list