From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DBB59A0A02 for ; Thu, 6 May 2021 12:40:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF404410F4; Thu, 6 May 2021 12:40:20 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 9AFB040040; Thu, 6 May 2021 12:40:16 +0200 (CEST) IronPort-SDR: nrAtzBYESIbDYecEiKnsic1fE3bqlhdRo1cupihD2hyQtt7jf1H96ICDTAujtbEu9xbCAptsgP /YFLKEzXtv2Q== X-IronPort-AV: E=McAfee;i="6200,9189,9975"; a="219318561" X-IronPort-AV: E=Sophos;i="5.82,277,1613462400"; d="scan'208";a="219318561" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2021 03:40:13 -0700 IronPort-SDR: u2rURl2PgBW3CAj6P+3txlgYzLGxz6QuJaCBBC9obex+z1Pn7uyoZnOkYNsUXiMDTq0y/4vztF hS3ImLz2A/Ew== X-IronPort-AV: E=Sophos;i="5.82,277,1613462400"; d="scan'208";a="434288877" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.0.237]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 06 May 2021 03:40:11 -0700 Date: Thu, 6 May 2021 11:40:05 +0100 From: Bruce Richardson To: David Marchand Cc: dev@dpdk.org, stable@dpdk.org, Anatoly Burakov , Stephen Hemminger Message-ID: References: <20210506100637.23645-1-david.marchand@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210506100637.23645-1-david.marchand@redhat.com> Subject: Re: [dpdk-stable] [PATCH] eal: fix leak in shared lib mode detection X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Thu, May 06, 2021 at 12:06:37PM +0200, David Marchand wrote: > 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") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand > --- > lib/eal/common/eal_common_options.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > 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) > } > > 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; > } > Acked-by: Bruce Richardson Since this is not really a leak, I'm not sure it needs backport, but no harm in CC'ing stable and letting maintainers choose.