From patchwork Mon Jul 26 03:58:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 44470 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 213EE396E44B for ; Mon, 26 Jul 2021 04:00:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 213EE396E44B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627272025; bh=Smc5RpTQ1F//Ad/q+fRuCmVF9bXqcUbIO08Ak29+Rf8=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=s5ogaCbo4pFY/IYcf+iygdySuyRFQGSYtgW8IBM29RIQYHAYxId9OiXBhLIEheikv OObHxw9w1bWhO5Oic+l/mk6Ol2nz6Q4XZsL6pScump0PwV82fc96Ue69xSxSgDkLHC f480LJrfaK3liIqk7Ywr9XsuZRlYAzFS19qmtAz0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by sourceware.org (Postfix) with ESMTPS id 4FDC7384603D for ; Mon, 26 Jul 2021 03:58:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FDC7384603D Received: by mail-qv1-xf49.google.com with SMTP id m15-20020a0cbf0f0000b02902e60d75210eso7107317qvi.19 for ; Sun, 25 Jul 2021 20:58:30 -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=Smc5RpTQ1F//Ad/q+fRuCmVF9bXqcUbIO08Ak29+Rf8=; b=Rel7LXSxP5AuKGkqPUUacfJVWU/43RYF2Rot6i6KAjK+PWdFKcXX0Sxrtt3mEU2qt7 4dsAxXFo3kVBIZAN4nJBaO6cQuN3wnh8ZVupoIABSANQpttd15j+z8yLGlwchiO2/Xvw Kq5BDRgh9EN2SkC9Ob/2UIWFfpjVPhRLwEJlC8Jv7wsgJTb12lLgSzdcUUx8NLnQTtLM Sr54JdR9oh2Y9IwFH/5X5XP3oTvFgzz8be8UFlbhm0krChBHAmJRUleRC7UtrVafxx6R ekMYCkiGF8UAn04anNs9/JXOfovNh1bbRrqyk4k/8CfNPsfRROqJLhGg3QiSQDfasUHb IwBA== X-Gm-Message-State: AOAM532RIt3tnQI4Vl/X79WCV/l1jW4Xb3A/lVI0NS9CZdSd/6IBkR4s GQTmlTHFUJLr9nNE2+yWdhRTB7dwXqTsMSrOlHSU3fk/UgMD/unuvvBbQDxkAq2ZasrRosiBZhE 7HulKF6zOHsIFq2bPpXB4tQtu8YdZMP2ueKBpyh+P2zKClshhTywKCuAO1jcnBj44/5be X-Google-Smtp-Source: ABdhPJy9kEM3rhX6u4CAaapuXiiGSXLeJkqpElqk/CKsg8u200fWoxbEx+0lKWGAc9zL2c9EQLUaogY9ZCLc X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:565c:23d5:ef81:9e9d]) (user=maskray job=sendgmr) by 2002:a0c:fb03:: with SMTP id c3mr15924715qvp.19.1627271909824; Sun, 25 Jul 2021 20:58:29 -0700 (PDT) Date: Sun, 25 Jul 2021 20:58:01 -0700 In-Reply-To: <20210726035802.275992-1-maskray@google.com> Message-Id: <20210726035802.275992-3-maskray@google.com> Mime-Version: 1.0 References: <20210726035802.275992-1-maskray@google.com> Subject: [PATCH 2/3] elf: Skip tst-auditlogmod-* if the linker doesn't support --depaudit To: libc-alpha@sourceware.org X-Spam-Status: No, score=-19.5 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-Patchwork-Original-From: Fangrui Song via Libc-alpha From: Fangrui Song Reply-To: Fangrui Song Cc: Fangrui Song Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 87a70d6c7a..09f860a268 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-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)