From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3IxEMYQcKCoQui0szi6owwotm.kwutqjk-itxpi0w2zkm4izm.wzo@flex--maskray.bounces.google.com> Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by sourceware.org (Postfix) with ESMTPS id EFFAB3980C36 for ; Thu, 5 Aug 2021 16:26:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EFFAB3980C36 Received: by mail-yb1-xb49.google.com with SMTP id g11-20020a25ae4b0000b02905792fb55b0bso6733905ybe.9 for ; Thu, 05 Aug 2021 09:26:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=//mu8vsxRkCR/DSwqJN10zkIKx9H3M27uws6NVDKL6o=; b=M8YmqTlCnTLit60hRhKT+47+b6xF4XBfQtVUCSxCDp8HZBya4oYDTklTZIxSqbBYvq jcURIGsFBlar0R/Y5nlEUtJrFe3eJ8PDzMFj+Px+t/XVUUIdA2nPOWV1i2XsjgPpsdus YnXCmhi1wKpKJcsRXUiVduGvU6NcyjRhrMWNZ2wh94BnSUj6Pua535xze6EUYDtWipdU CpnxwViLlM5fjXMOBron82F9nn8F2gy6Ez29LyqNQswk0Al29Pv1me+cfQkmYdRSeGFv bxIFmEPKqZSZahn+rOEs2BRR+UMtaoe3NBjZ/yJWpS+rYQdA9b8whYWic0ZF6yiKRrqC hYXg== X-Gm-Message-State: AOAM530Nmhs+S1yZfRPQ5mQPj6bUV+mjHAHCKXdszZR9juxDmqg3nPwv MswZH+hOQJO5llHoZecI2COPIkedx/PJsv+ZiR1eyWxYjsuHU/aCP7zG5DIFx4pXJ19+0/5+I0w 6atoJVFEmpTpEbwML89+GvDndE1R7IaaRDPCgvTGh3vo4no1EleJqvEVi+tjlj7sLRElO X-Google-Smtp-Source: ABdhPJwC7n2k9q752NNXVyvTLtPJZlrRHnMMRJfpS4KqZ4rRhlP3wFDHTb6iLVsj74tdMtsn23PWDHB04CKy X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:6668:5d25:689f:8ff1]) (user=maskray job=sendgmr) by 2002:a25:afcd:: with SMTP id d13mr6703853ybj.504.1628180771472; Thu, 05 Aug 2021 09:26:11 -0700 (PDT) Date: Thu, 5 Aug 2021 09:26:00 -0700 In-Reply-To: <20210805162601.1200851-1-maskray@google.com> Message-Id: <20210805162601.1200851-3-maskray@google.com> Mime-Version: 1.0 References: <20210805162601.1200851-1-maskray@google.com> Subject: [PATCH v2 2/3] elf: Skip tst-auditlogmod-* if the linker doesn't support --depaudit [BZ #28151] From: Fangrui Song To: libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-20.0 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham 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-List-Received-Date: Thu, 05 Aug 2021 16:26:13 -0000 gold and ld.lld do not support --audit or --depaudit. --- configure | 34 ++++++++++++++++++++++++++++++++++ configure.ac | 4 ++++ elf/Makefile | 4 +++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 9619c10991..9b966196d4 100755 --- a/configure +++ b/configure @@ -5969,6 +5969,40 @@ $as_echo "$libc_linker_feature" >&6; } config_vars="$config_vars have-z-start-stop-gc = $libc_cv_z_start_stop_gc" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5 +$as_echo_n "checking for linker that supports --depaudit... " >&6; } +libc_linker_feature=no +if test x"$gnu_ld" = x"yes"; then + libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--depaudit"` + if test -n "$libc_linker_check"; then + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + libc_linker_feature=yes + fi + rm -f conftest* + fi +fi +if test $libc_linker_feature = yes; then + libc_cv_depaudit=yes +else + libc_cv_depaudit=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5 +$as_echo "$libc_linker_feature" >&6; } +config_vars="$config_vars +have-depaudit = $libc_cv_depaudit" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5 $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; } libc_linker_feature=no diff --git a/configure.ac b/configure.ac index 34ecbba540..17a4c9a1ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1337,6 +1337,10 @@ LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc], [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no]) LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc]) +LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x], + [libc_cv_depaudit=yes], [libc_cv_depaudit=no]) +LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit]) + LIBC_LINKER_FEATURE([--no-dynamic-linker], [-Wl,--no-dynamic-linker], [libc_cv_no_dynamic_linker=yes], diff --git a/elf/Makefile b/elf/Makefile index d05f410592..b62278ee86 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -219,7 +219,6 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \ tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \ tst-dlopenfail-2 \ tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \ - tst-audit14 tst-audit15 tst-audit16 tst-audit17 \ tst-single_threaded tst-single_threaded-pthread \ tst-tls-ie tst-tls-ie-dlmopen argv0test \ tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \ @@ -238,6 +237,9 @@ selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) ifneq ($(selinux-enabled),1) tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog endif +ifeq ($(have-depaudit),yes) +tests += tst-audit14 tst-audit15 tst-audit16 +endif endif tests += $(tests-execstack-$(have-z-execstack)) ifeq ($(run-built-tests),yes) -- 2.32.0.605.g8dce9f2422-goog