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 91528A0547 for ; Sat, 13 Feb 2021 00:40:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C3F94068F; Sat, 13 Feb 2021 00:40:56 +0100 (CET) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id 08D3E4068F for ; Sat, 13 Feb 2021 00:40:54 +0100 (CET) Received: by mail-wm1-f50.google.com with SMTP id m1so1334189wml.2 for ; Fri, 12 Feb 2021 15:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ChXkAZyi8xCa/NbnbzYlQiiyytzZtMCaZzxAjsUB5Zg=; b=EL/K1xUgsKgCLuqE5upABb7IzLe2XcfSPluGVrnpk9uTm8orrwPVRoM5UWzTFz8ARc oTBXi2RwnLTrJ+52mh2/ew3fLBDJRiVzUI+MD8eRVHwP4zqh2vsXc9ERrANf4RN/Pmul 3hj7NlH8ftmRP9uj9kABIEV3kylUit3EmT8zU1/Uuhy70jW+zy/T5lIMCNUmucWsaLqi ustj5ik21uWvOjPqI0NouBsNLy8VJKur+NF1CDkFfaVk32WTLYlibJoBQgE4Xap7M1hs RaFFf68wQT6S45AaCLOsZk50vQuPXb0fiOmKGkpt/lWpupL/jWcyIGunPU/qF+TLKOD+ 8UnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ChXkAZyi8xCa/NbnbzYlQiiyytzZtMCaZzxAjsUB5Zg=; b=ULDJvvyVO4hicpnDdAeFLypx7Uu9VkYm7eWs5d5Irrqg2UBHMuC3KDTwnmNGB6XokI rUJ/r3vCJ0Ne2AxVwv839jOvjDHbUuEUbQ7Sv2iwluoNP7p9thj1JczXmfifwS7+UNWA MdAuOFhcFYXI2wALky5rMSli60SYTKwrQ9s7kse1HgxktHrRC8DLREokiafJW2qKy0Vm ypVLiUUkzZkSSmCqyB6MmYwjSyK47KBVJXWVydtEvy6f+fLq2b+dFJo35Hboi2Zk3W6J E+2a3elkc0KU/4xcXjpFkP7NIJZOIKWB53iOAOrg7YDlBnY4uCeHumvgyKBXLedS0Zn3 AUpg== X-Gm-Message-State: AOAM530m+gXBbZv9KRUqBGSK017ru+84o3Tc1je4Lecd0YeaPlJR7jO5 btbeAM+jzLNnzCvactBc7as= X-Google-Smtp-Source: ABdhPJx7GyWjqoFMTyWJOrFWqhJzWclzuqJIeZyK8K6NO7P/3eEEVTTBvgZLRfUb1+7da1ZGuR252Q== X-Received: by 2002:a1c:4e13:: with SMTP id g19mr4667607wmh.55.1613173254688; Fri, 12 Feb 2021 15:40:54 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:7a8e:ed70:5c52:ea3]) by smtp.gmail.com with ESMTPSA id d5sm4035989wrp.39.2021.02.12.15.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 15:40:53 -0800 (PST) From: luca.boccassi@gmail.com To: Bruce Richardson Cc: Sunil Pai G , dpdk stable Date: Fri, 12 Feb 2021 23:40:45 +0000 Message-Id: <20210212234050.255787-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'eal: fix automatic loading of drivers as shared libs' has been queued to stable release 20.11.1 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" Hi, FYI, your patch has been queued to stable release 20.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/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/dfc264c256874bfe56fb79403a24e0f1fe4c0383 Thanks. Luca Boccassi --- >From dfc264c256874bfe56fb79403a24e0f1fe4c0383 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Mon, 8 Feb 2021 16:33:19 +0000 Subject: [PATCH] eal: fix automatic loading of drivers as shared libs [ upstream commit 9ff791eff609138a69edd89bf4abde71511eef6d ] When checking the loading of EAL shared lib to see if we have a shared DPDK build, we only want to include part of the ABI version in the check rather than the whole thing. For example, with ABI version 21.1 for DPDK release 21.02, the linker links the binary against librte_eal.so.21, without the ".1". To avoid any further brittleness in this area, we can check for multiple versions when doing the check, since just about any version of EAL implies a shared build. Therefore we check for presence of librte_eal.so with full ABI_VERSION extension, and then repeatedly remove the end part of the filename after the last dot, checking each time. For example (debug log output for static build): EAL: Checking presence of .so 'librte_eal.so.21.1' EAL: Checking presence of .so 'librte_eal.so.21' EAL: Checking presence of .so 'librte_eal.so' EAL: Detected static linkage of DPDK Fixes: 7781950f4d38 ("eal: fix shared lib mode detection") Signed-off-by: Bruce Richardson Tested-by: Sunil Pai G --- lib/librte_eal/common/eal_common_options.c | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 424e8bcf87..622c7bc429 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -494,6 +494,39 @@ out: return retval; } +static int +is_shared_build(void) +{ +#define EAL_SO "librte_eal.so" + char soname[32]; + size_t len, minlen = strlen(EAL_SO); + + len = strlcpy(soname, EAL_SO"."ABI_VERSION, sizeof(soname)); + if (len > sizeof(soname)) { + RTE_LOG(ERR, EAL, "Shared lib name too long in shared build check\n"); + len = sizeof(soname) - 1; + } + + while (len >= minlen) { + /* 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) { + RTE_LOG(INFO, EAL, "Detected shared linkage of DPDK\n"); + return 1; + } + + /* remove any version numbers off the end to retry */ + while (len-- > 0) + if (soname[len] == '.') { + soname[len] = '\0'; + break; + } + } + + RTE_LOG(INFO, EAL, "Detected static linkage of DPDK\n"); + return 0; +} + int eal_plugins_init(void) { @@ -505,7 +538,7 @@ eal_plugins_init(void) * (Using dlopen with NOLOAD flag on EAL, will return NULL if the EAL * shared library is not already loaded i.e. it's statically linked.) */ - if (dlopen("librte_eal.so."ABI_VERSION, RTLD_LAZY | RTLD_NOLOAD) != NULL && + if (is_shared_build() && *default_solib_dir != '\0' && stat(default_solib_dir, &sb) == 0 && S_ISDIR(sb.st_mode)) -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-12 23:40:09.908777582 +0000 +++ 0001-eal-fix-automatic-loading-of-drivers-as-shared-libs.patch 2021-02-12 23:40:09.855090191 +0000 @@ -1 +1 @@ -From 9ff791eff609138a69edd89bf4abde71511eef6d Mon Sep 17 00:00:00 2001 +From dfc264c256874bfe56fb79403a24e0f1fe4c0383 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 9ff791eff609138a69edd89bf4abde71511eef6d ] + @@ -25 +26,0 @@ -Cc: stable@dpdk.org