From patchwork Wed Dec 8 15:24:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 48635 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A69B33858436 for ; Wed, 8 Dec 2021 15:26:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A69B33858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1638977190; bh=i0h0iGObfgjWc/NN2BgDkhUC8pwF1bTG4AL6bn/7s/Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=DhAmhnaC69+q2Vbt4g4fp2kXMYBn8WhzhsHI5T7dgCB2o6qFN3g+EOwAAolX+f7Tu jt1Po77wqVG0C6YQSaURfo9I9QaC7B/FQvVM0VSf5ckrKHaqbjuUcrPuaQUWJjg8r4 eUt0NLENLvPQsgq8hhDcUjN/wqBG2mKuaojrR+sA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 3FDA03858424 for ; Wed, 8 Dec 2021 15:25:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FDA03858424 Received: by mail-pf1-x42a.google.com with SMTP id i12so2727135pfd.6 for ; Wed, 08 Dec 2021 07:25:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=i0h0iGObfgjWc/NN2BgDkhUC8pwF1bTG4AL6bn/7s/Y=; b=SwwslUBmVmHHC4VLy0YCCtF0j2EItOfbp17DSDDTQhE4UKdA7zJ/5KHXfAp5W0tVfu tszw9/9SsJM03sds99v9TiGO/tLyGq2j+jA3d16rLym9D7B/dT366JbrTZH1qmYlFJeC kJEZ8uBjkADR6glxi8hBY/QeUvKBay8p1N4U+Tc/wIkosThSty5SelMkUwF4eGvte2dE JKYeYnK4H2qIHE/gI0w9x3Pz9AFAdml69f2ZVWMqxtW0f0Edn7E5+p/DNfQXVy5E406f te7rvQpcP3r0RLk0jaIogHfjaPlP4iWnLDDIGKamv/oe1+ha2pLKRt5VwmglmAYAr69Y SjRQ== X-Gm-Message-State: AOAM531dcPKjqePNpdbirT/yd/ySIik7L4gUvQ6qR3BLJzNCK8ZhTuLc H3tydIaPmMwesH2p6tOzYgY= X-Google-Smtp-Source: ABdhPJzWKCFQNvrZbibaEcjr2uEsbe//+cBk7/bZCwU23QRc3Ach1+MDRWqAOf/4o1s8ByDQGoLMtw== X-Received: by 2002:a63:d245:: with SMTP id t5mr28875439pgi.483.1638977103373; Wed, 08 Dec 2021 07:25:03 -0800 (PST) Received: from gnu-cfl-2.localdomain ([172.58.35.133]) by smtp.gmail.com with ESMTPSA id f5sm3191415pju.15.2021.12.08.07.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 07:25:02 -0800 (PST) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id A65BE1A015A; Wed, 8 Dec 2021 07:25:01 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v3 0/3] Properly handle DT_RUNPATH Date: Wed, 8 Dec 2021 07:24:58 -0800 Message-Id: <20211208152501.1483087-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3021.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" DT_RUNPATH is only used to find the immediate dependencies of the executable or shared object containing the DT_RUNPATH entry: 1. Define link-test-modules-rpath-link if $(build-hardcoded-path-in-tests) is yes. 2. Use $(link-test-modules-rpath-link) in build-module-helper so that test modules can dlopen modules with DT_RUNPATH. 3. Add a test to show why link-test-modules-rpath-link is needed. 4. The glibc internal NSS functions should always load NSS modules from the system. For testing purpose, disable DT_RUNPATH on NSS tests so that the glibc internal NSS functions can load testing NSS modules via DT_RPATH. 5. Update glibc LD_AUDIT dlopen call to try the DT_RUNPATH entry of the executable. H.J. Lu (3): Add and use link-test-modules-rpath-link [BZ #28455] Disable DT_RUNPATH on NSS tests [BZ #28455] elf: Also try DT_RUNPATH for LD_AUDIT dlopen [BZ #28455] Makeconfig | 2 ++ Makerules | 1 + elf/Makefile | 16 ++++++++++++++-- elf/dl-load.c | 15 +++++++++++++++ elf/tst-audit14a.c | 1 + elf/tst-global2.c | 32 ++++++++++++++++++++++++++++++++ elf/tst-globalmod2.c | 41 +++++++++++++++++++++++++++++++++++++++++ nss/Makefile | 8 ++++++++ 8 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 elf/tst-audit14a.c create mode 100644 elf/tst-global2.c create mode 100644 elf/tst-globalmod2.c