From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id AEA873856967 for ; Wed, 5 Jul 2023 14:11:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AEA873856967 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688566285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kqs+rZsZWO4NfSXpCqvrPjXPsvRCljePEcFqPuLV7ec=; b=aksgDCYvNEMMYOg4ROViqDAwumLZRw8kR84Fu60zm8V9CjHjS6fauk7ponXlbw78qItaNB 675JpNyAHGBp+HBifPmdHXpU4RHjlbUlDpMbhLqTyTj3vSvdEdwss93vWXtZpuTcUDVrJd K6hNX4YokTG7uVuhHtyAeyosnNg6FSQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-673-PP4z45i4MoiB0ctiOAOhlQ-1; Wed, 05 Jul 2023 10:11:19 -0400 X-MC-Unique: PP4z45i4MoiB0ctiOAOhlQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AACF03811F30; Wed, 5 Jul 2023 14:11:11 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.42.28.234]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06F0EF5CF0; Wed, 5 Jul 2023 14:11:10 +0000 (UTC) From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= To: libc-alpha@sourceware.org Cc: siddhesh@gotplt.org, fberat@redhat.com, Siddhesh Poyarekar Subject: [PATCH v5 04/14] string: Ensure *_chk routines have their hidden builtin definition available Date: Wed, 5 Jul 2023 16:10:39 +0200 Message-ID: <20230705141055.274575-5-fberat@redhat.com> In-Reply-To: <20230705141055.274575-1-fberat@redhat.com> References: <20230705141055.274575-1-fberat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: If libc_hidden_builtin_{def,proto} isn't properly set for *_chk routines, there are unwanted PLT entries in libc.so. Reviewed-by: Siddhesh Poyarekar --- debug/memcpy_chk.c | 1 + debug/memmove_chk.c | 1 + debug/mempcpy_chk.c | 1 + debug/memset_chk.c | 1 + debug/stpcpy_chk.c | 1 + include/string.h | 7 +++++++ sysdeps/i386/i586/memcpy.S | 1 + sysdeps/i386/i586/memset.S | 1 + sysdeps/i386/i686/memcpy.S | 1 + sysdeps/i386/i686/memmove.S | 1 + sysdeps/i386/i686/mempcpy.S | 1 + sysdeps/i386/i686/memset.S | 1 + sysdeps/i386/i686/multiarch/memcpy_chk.c | 4 ++++ sysdeps/i386/i686/multiarch/memmove_chk.c | 4 ++++ sysdeps/i386/i686/multiarch/mempcpy_chk.c | 4 ++++ sysdeps/i386/i686/multiarch/memset_chk.c | 5 ++++- sysdeps/i386/memcpy_chk.S | 1 + sysdeps/i386/memmove_chk.S | 1 + sysdeps/i386/mempcpy_chk.S | 1 + sysdeps/i386/memset_chk.S | 1 + sysdeps/x86_64/memcpy_chk.S | 1 + sysdeps/x86_64/memmove_chk.S | 1 + sysdeps/x86_64/mempcpy_chk.S | 1 + sysdeps/x86_64/memset_chk.S | 1 + sysdeps/x86_64/multiarch/memcpy_chk.c | 4 ++++ sysdeps/x86_64/multiarch/memmove_chk.c | 4 ++++ sysdeps/x86_64/multiarch/mempcpy_chk.c | 4 ++++ sysdeps/x86_64/multiarch/memset_chk.c | 4 ++++ 28 files changed, 58 insertions(+), 1 deletion(-) diff --git a/debug/memcpy_chk.c b/debug/memcpy_chk.c index c6dd94c83f..1e4a82c063 100644 --- a/debug/memcpy_chk.c +++ b/debug/memcpy_chk.c @@ -28,3 +28,4 @@ __memcpy_chk (void *dstpp, const void *srcpp, size_t len, size_t dstlen) return memcpy (dstpp, srcpp, len); } +libc_hidden_builtin_def (__memcpy_chk) diff --git a/debug/memmove_chk.c b/debug/memmove_chk.c index 8922a1ba26..b714aa474c 100644 --- a/debug/memmove_chk.c +++ b/debug/memmove_chk.c @@ -32,3 +32,4 @@ MEMMOVE_CHK (void *dest, const void *src, size_t len, size_t destlen) return memmove (dest, src, len); } +libc_hidden_builtin_def (MEMMOVE_CHK) diff --git a/debug/mempcpy_chk.c b/debug/mempcpy_chk.c index 17a46a3b4d..b47b14ee9a 100644 --- a/debug/mempcpy_chk.c +++ b/debug/mempcpy_chk.c @@ -29,3 +29,4 @@ __mempcpy_chk (void *dstpp, const void *srcpp, size_t len, size_t dstlen) return __mempcpy (dstpp, srcpp, len); } +libc_hidden_builtin_def (__mempcpy_chk) diff --git a/debug/memset_chk.c b/debug/memset_chk.c index 4fc0b55d82..93901f5f34 100644 --- a/debug/memset_chk.c +++ b/debug/memset_chk.c @@ -26,3 +26,4 @@ __memset_chk (void *dstpp, int c, size_t len, size_t dstlen) return memset (dstpp, c, len); } +libc_hidden_builtin_def (__memset_chk) diff --git a/debug/stpcpy_chk.c b/debug/stpcpy_chk.c index 230b52bd01..518dd78dca 100644 --- a/debug/stpcpy_chk.c +++ b/debug/stpcpy_chk.c @@ -32,3 +32,4 @@ __stpcpy_chk (char *dest, const char *src, size_t destlen) return memcpy (dest, src, len + 1) + len; } +libc_hidden_builtin_def (__stpcpy_chk) diff --git a/include/string.h b/include/string.h index 0c78ad2539..659530d1aa 100644 --- a/include/string.h +++ b/include/string.h @@ -208,6 +208,13 @@ extern char *__strcat_chk (char *__restrict __dest, extern char *__strncat_chk (char *__restrict __dest, const char *__restrict __src, size_t __len, size_t __destlen) __THROW; + +libc_hidden_builtin_proto (__memcpy_chk) +libc_hidden_builtin_proto (__memmove_chk) +libc_hidden_builtin_proto (__mempcpy_chk) +libc_hidden_builtin_proto (__memset_chk) +libc_hidden_builtin_proto (__stpcpy_chk) + #endif #endif diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S index 58061d5adf..e3405e577c 100644 --- a/sysdeps/i386/i586/memcpy.S +++ b/sysdeps/i386/i586/memcpy.S @@ -32,6 +32,7 @@ ENTRY (__memcpy_chk) cmpl %eax, 16(%esp) jb HIDDEN_JUMPTARGET (__chk_fail) END (__memcpy_chk) +libc_hidden_builtin_def (__memcpy_chk) #endif ENTRY (memcpy) diff --git a/sysdeps/i386/i586/memset.S b/sysdeps/i386/i586/memset.S index 413e8ec6a9..f1f0e1a99b 100644 --- a/sysdeps/i386/i586/memset.S +++ b/sysdeps/i386/i586/memset.S @@ -33,6 +33,7 @@ ENTRY (__memset_chk) cmpl %eax, 16(%esp) jb HIDDEN_JUMPTARGET (__chk_fail) END (__memset_chk) +libc_hidden_builtin_def (__memset_chk) #endif ENTRY (memset) diff --git a/sysdeps/i386/i686/memcpy.S b/sysdeps/i386/i686/memcpy.S index 604d3088f6..9b48ec0ea1 100644 --- a/sysdeps/i386/i686/memcpy.S +++ b/sysdeps/i386/i686/memcpy.S @@ -33,6 +33,7 @@ ENTRY_CHK (__memcpy_chk) cmpl %eax, 16(%esp) jb HIDDEN_JUMPTARGET (__chk_fail) END_CHK (__memcpy_chk) +libc_hidden_builtin_def (__memcpy_chk) #endif ENTRY (memcpy) diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S index cff06c27e5..06fe2a7668 100644 --- a/sysdeps/i386/i686/memmove.S +++ b/sysdeps/i386/i686/memmove.S @@ -35,6 +35,7 @@ ENTRY_CHK (__memmove_chk) cmpl %eax, 16(%esp) jb HIDDEN_JUMPTARGET (__chk_fail) END_CHK (__memmove_chk) +libc_hidden_builtin_def (__memmove_chk) #endif ENTRY (memmove) diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S index af3f2cca08..26f8501e7d 100644 --- a/sysdeps/i386/i686/mempcpy.S +++ b/sysdeps/i386/i686/mempcpy.S @@ -33,6 +33,7 @@ ENTRY_CHK (__mempcpy_chk) cmpl %eax, 16(%esp) jb HIDDEN_JUMPTARGET (__chk_fail) END_CHK (__mempcpy_chk) +libc_hidden_builtin_def (__mempcpy_chk) #endif ENTRY (__mempcpy) diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index d4891880d7..0b5e671d83 100644 --- a/sysdeps/i386/i686/memset.S +++ b/sysdeps/i386/i686/memset.S @@ -33,6 +33,7 @@ ENTRY_CHK (__memset_chk) cmpl %eax, 16(%esp) jb HIDDEN_JUMPTARGET (__chk_fail) END_CHK (__memset_chk) +libc_hidden_builtin_def (__memset_chk) #endif ENTRY (memset) diff --git a/sysdeps/i386/i686/multiarch/memcpy_chk.c b/sysdeps/i386/i686/multiarch/memcpy_chk.c index 5ac5cb1d7a..ec945dc91f 100644 --- a/sysdeps/i386/i686/multiarch/memcpy_chk.c +++ b/sysdeps/i386/i686/multiarch/memcpy_chk.c @@ -28,4 +28,8 @@ libc_ifunc_redirected (__redirect_memcpy_chk, __memcpy_chk, IFUNC_SELECTOR ()); +# ifdef SHARED +__hidden_ver1 (__memcpy_chk, __GI___memcpy_chk, __redirect_memcpy_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memcpy_chk); +# endif #endif diff --git a/sysdeps/i386/i686/multiarch/memmove_chk.c b/sysdeps/i386/i686/multiarch/memmove_chk.c index 28161d3c27..55c7601d5d 100644 --- a/sysdeps/i386/i686/multiarch/memmove_chk.c +++ b/sysdeps/i386/i686/multiarch/memmove_chk.c @@ -28,4 +28,8 @@ libc_ifunc_redirected (__redirect_memmove_chk, __memmove_chk, IFUNC_SELECTOR ()); +# ifdef SHARED +__hidden_ver1 (__memmove_chk, __GI___memmove_chk, __redirect_memmove_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memmove_chk); +# endif #endif diff --git a/sysdeps/i386/i686/multiarch/mempcpy_chk.c b/sysdeps/i386/i686/multiarch/mempcpy_chk.c index 36c81ae61a..83569cf9d9 100644 --- a/sysdeps/i386/i686/multiarch/mempcpy_chk.c +++ b/sysdeps/i386/i686/multiarch/mempcpy_chk.c @@ -28,4 +28,8 @@ libc_ifunc_redirected (__redirect_mempcpy_chk, __mempcpy_chk, IFUNC_SELECTOR ()); +# ifdef SHARED +__hidden_ver1 (__mempcpy_chk, __GI___mempcpy_chk, __redirect_mempcpy_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__mempcpy_chk); +# endif #endif diff --git a/sysdeps/i386/i686/multiarch/memset_chk.c b/sysdeps/i386/i686/multiarch/memset_chk.c index cf3e811327..1a7503858d 100644 --- a/sysdeps/i386/i686/multiarch/memset_chk.c +++ b/sysdeps/i386/i686/multiarch/memset_chk.c @@ -28,5 +28,8 @@ libc_ifunc_redirected (__redirect_memset_chk, __memset_chk, IFUNC_SELECTOR ()); - +# ifdef SHARED +__hidden_ver1 (__memset_chk, __GI___memset_chk, __redirect_memset_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memset_chk); +# endif #endif diff --git a/sysdeps/i386/memcpy_chk.S b/sysdeps/i386/memcpy_chk.S index b5244cc69b..7b12c12aba 100644 --- a/sysdeps/i386/memcpy_chk.S +++ b/sysdeps/i386/memcpy_chk.S @@ -31,4 +31,5 @@ ENTRY (__memcpy_chk) jb __chk_fail jmp memcpy END (__memcpy_chk) +libc_hidden_builtin_def (__memcpy_chk) #endif diff --git a/sysdeps/i386/memmove_chk.S b/sysdeps/i386/memmove_chk.S index 517d8cb15a..604aea8305 100644 --- a/sysdeps/i386/memmove_chk.S +++ b/sysdeps/i386/memmove_chk.S @@ -30,4 +30,5 @@ ENTRY (__memmove_chk) jb __chk_fail jmp memmove END (__memmove_chk) +libc_hidden_builtin_def (MEMMOVE_CHK) #endif diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S index 1e9bf71bfb..276eab1e8a 100644 --- a/sysdeps/i386/mempcpy_chk.S +++ b/sysdeps/i386/mempcpy_chk.S @@ -30,4 +30,5 @@ ENTRY (__mempcpy_chk) jb __chk_fail jmp __mempcpy END (__mempcpy_chk) +libc_hidden_builtin_def (__mempcpy_chk) #endif diff --git a/sysdeps/i386/memset_chk.S b/sysdeps/i386/memset_chk.S index 0e6060a0a6..a2e9208e1c 100644 --- a/sysdeps/i386/memset_chk.S +++ b/sysdeps/i386/memset_chk.S @@ -30,4 +30,5 @@ ENTRY (__memset_chk) jb __chk_fail jmp memset END (__memset_chk) +libc_hidden_builtin_def (__memset_chk) #endif diff --git a/sysdeps/x86_64/memcpy_chk.S b/sysdeps/x86_64/memcpy_chk.S index 25cbeb37ee..43843a7abb 100644 --- a/sysdeps/x86_64/memcpy_chk.S +++ b/sysdeps/x86_64/memcpy_chk.S @@ -30,4 +30,5 @@ ENTRY (__memcpy_chk) jb __chk_fail jmp memcpy END (__memcpy_chk) +libc_hidden_builtin_def (__memcpy_chk) #endif diff --git a/sysdeps/x86_64/memmove_chk.S b/sysdeps/x86_64/memmove_chk.S index 165d42cfa8..37e2c30ba8 100644 --- a/sysdeps/x86_64/memmove_chk.S +++ b/sysdeps/x86_64/memmove_chk.S @@ -30,4 +30,5 @@ ENTRY (__memmove_chk) jb __chk_fail jmp memmove END (__memmove_chk) +libc_hidden_builtin_def (MEMMOVE_CHK) #endif diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S index b60ee4ff08..facdac50d8 100644 --- a/sysdeps/x86_64/mempcpy_chk.S +++ b/sysdeps/x86_64/mempcpy_chk.S @@ -30,4 +30,5 @@ ENTRY (__mempcpy_chk) jb __chk_fail jmp __mempcpy END (__mempcpy_chk) +libc_hidden_builtin_def (__mempcpy_chk) #endif diff --git a/sysdeps/x86_64/memset_chk.S b/sysdeps/x86_64/memset_chk.S index ed53b8927f..c927884b1a 100644 --- a/sysdeps/x86_64/memset_chk.S +++ b/sysdeps/x86_64/memset_chk.S @@ -30,4 +30,5 @@ ENTRY (__memset_chk) jb __chk_fail jmp memset END (__memset_chk) +libc_hidden_builtin_def (__memset_chk) #endif diff --git a/sysdeps/x86_64/multiarch/memcpy_chk.c b/sysdeps/x86_64/multiarch/memcpy_chk.c index 5ac5cb1d7a..ec945dc91f 100644 --- a/sysdeps/x86_64/multiarch/memcpy_chk.c +++ b/sysdeps/x86_64/multiarch/memcpy_chk.c @@ -28,4 +28,8 @@ libc_ifunc_redirected (__redirect_memcpy_chk, __memcpy_chk, IFUNC_SELECTOR ()); +# ifdef SHARED +__hidden_ver1 (__memcpy_chk, __GI___memcpy_chk, __redirect_memcpy_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memcpy_chk); +# endif #endif diff --git a/sysdeps/x86_64/multiarch/memmove_chk.c b/sysdeps/x86_64/multiarch/memmove_chk.c index 28161d3c27..55c7601d5d 100644 --- a/sysdeps/x86_64/multiarch/memmove_chk.c +++ b/sysdeps/x86_64/multiarch/memmove_chk.c @@ -28,4 +28,8 @@ libc_ifunc_redirected (__redirect_memmove_chk, __memmove_chk, IFUNC_SELECTOR ()); +# ifdef SHARED +__hidden_ver1 (__memmove_chk, __GI___memmove_chk, __redirect_memmove_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memmove_chk); +# endif #endif diff --git a/sysdeps/x86_64/multiarch/mempcpy_chk.c b/sysdeps/x86_64/multiarch/mempcpy_chk.c index 36c81ae61a..83569cf9d9 100644 --- a/sysdeps/x86_64/multiarch/mempcpy_chk.c +++ b/sysdeps/x86_64/multiarch/mempcpy_chk.c @@ -28,4 +28,8 @@ libc_ifunc_redirected (__redirect_mempcpy_chk, __mempcpy_chk, IFUNC_SELECTOR ()); +# ifdef SHARED +__hidden_ver1 (__mempcpy_chk, __GI___mempcpy_chk, __redirect_mempcpy_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__mempcpy_chk); +# endif #endif diff --git a/sysdeps/x86_64/multiarch/memset_chk.c b/sysdeps/x86_64/multiarch/memset_chk.c index d81147a70c..1a7503858d 100644 --- a/sysdeps/x86_64/multiarch/memset_chk.c +++ b/sysdeps/x86_64/multiarch/memset_chk.c @@ -28,4 +28,8 @@ libc_ifunc_redirected (__redirect_memset_chk, __memset_chk, IFUNC_SELECTOR ()); +# ifdef SHARED +__hidden_ver1 (__memset_chk, __GI___memset_chk, __redirect_memset_chk) + __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memset_chk); +# endif #endif -- 2.41.0