[dpdk-stable] patch 'eal: fix leak in shared lib mode detection' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Sat Jun 12 01:03:10 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

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

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/3cb6827a324761d14641ddb2126e570bef5950c9

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 3cb6827a324761d14641ddb2126e570bef5950c9 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Thu, 6 May 2021 12:06:37 +0200
Subject: [PATCH] eal: fix leak in shared lib mode detection
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit b81bf1efe3ff7bf6bedf4dcce1e3fb90ac9c8d3c ]

This is reported by our internal covscan:

1. dpdk-20.11/lib/librte_eal/common/eal_common_options.c:508: alloc_fn:
Storage is returned from allocation function "dlopen".
6. dpdk-20.11/lib/librte_eal/common/eal_common_options.c:508:
leaked_storage: Failing to save or free storage allocated by
"dlopen("librte_eal.so.21.0", 5)" leaks it.

 #   506|   	 * shared library is not already loaded i.e. it's
 #   statically linked.)
 #   507|   	 */
 #   508|-> 	if (dlopen("librte_eal.so."ABI_VERSION, RTLD_LAZY |
 #   RTLD_NOLOAD) != NULL &&
 #   509|   			*default_solib_dir != '\0' &&
 #   510|   			stat(default_solib_dir, &sb) == 0 &&

This leak is not an issue per se, but on the other hand, this is easy
to fix and I prefer not having to waive this warning later.

Fixes: 06c7871dde01 ("eal: restrict default plugin path to shared lib mode")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/librte_eal/common/eal_common_options.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 94b560a8ab..f8ab47435d 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -508,10 +508,14 @@ is_shared_build(void)
 	}
 
 	while (len >= minlen) {
+		void *handle;
+
 		/* check if we have this .so loaded, if so - shared build */
 		RTE_LOG(DEBUG, EAL, "Checking presence of .so '%s'\n", soname);
-		if (dlopen(soname, RTLD_LAZY | RTLD_NOLOAD) != NULL) {
+		handle = dlopen(soname, RTLD_LAZY | RTLD_NOLOAD);
+		if (handle != NULL) {
 			RTE_LOG(INFO, EAL, "Detected shared linkage of DPDK\n");
+			dlclose(handle);
 			return 1;
 		}
 
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-06-12 06:53:59.100017400 +0800
+++ 0096-eal-fix-leak-in-shared-lib-mode-detection.patch	2021-06-12 06:53:56.450000000 +0800
@@ -1 +1 @@
-From b81bf1efe3ff7bf6bedf4dcce1e3fb90ac9c8d3c Mon Sep 17 00:00:00 2001
+From 3cb6827a324761d14641ddb2126e570bef5950c9 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit b81bf1efe3ff7bf6bedf4dcce1e3fb90ac9c8d3c ]
@@ -26 +28,0 @@
-Cc: stable at dpdk.org
@@ -31 +33 @@
- lib/eal/common/eal_common_options.c | 6 +++++-
+ lib/librte_eal/common/eal_common_options.c | 6 +++++-
@@ -34,5 +36,5 @@
-diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
-index 97ab6e00fd..ff5861b5f3 100644
---- a/lib/eal/common/eal_common_options.c
-+++ b/lib/eal/common/eal_common_options.c
-@@ -509,10 +509,14 @@ is_shared_build(void)
+diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
+index 94b560a8ab..f8ab47435d 100644
+--- a/lib/librte_eal/common/eal_common_options.c
++++ b/lib/librte_eal/common/eal_common_options.c
+@@ -508,10 +508,14 @@ is_shared_build(void)


More information about the stable mailing list