From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id F1A563858C62 for ; Sat, 4 May 2024 12:26:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1A563858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F1A563858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714825584; cv=none; b=HI7KAosXi3TyzQ0/U6DkA49gscsNftYbc/OjpSUAlGHVjTcPVk4p4j/fnDGCqw4G5fQ5iayLI/QbTKHMg/xtiBb/jFT10jg6bcAUGyRerQ88zkJhLUoLSj/rSBM/d9M6ewnAtc9yOaZkar4MIuB6HL6l6aUGYKr4IYii/CN5XZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714825584; c=relaxed/simple; bh=3b5wF4ZAGyK2qIT7ycLTEM3pH6qXLXgSX9ZQiHnaBaQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=XGPSWk7NwmSC/eeYyXabEi47GQU/xYbQMFSdYxBv0u4qO5dJ4izV6zG2kMh/ZuTJrmDx3CYiR9RyD/1jF8S1WaDv9hrLffdOd8sSFyQv5iNn6YZRAaCWl5wl8aofXf4wmd2twJEeL7oRp6xaMQbRMiuVWqJjYVjKSLumKj+pxho= ARC-Authentication-Results: i=1; server2.sourceware.org From: Sam James To: libc-stable@sourceware.org Cc: Gabi Falk , Sam James , "H . J . Lu" , "Dmitry V . Levin" Subject: [COMMITTED 2.39 2/3] i686: Fix multiple definitions of __memmove_chk and __memset_chk Date: Sat, 4 May 2024 13:26:05 +0100 Message-ID: <20240504122607.2559911-2-sam@gentoo.org> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240504122607.2559911-1-sam@gentoo.org> References: <20240504122607.2559911-1-sam@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP 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: From: Gabi Falk Commit c73c96a4a1af1326df7f96eec58209e1e04066d8 updated memcpy.S and mempcpy.S, but omitted memmove.S and memset.S. As a result, the static library built as PIC, whether with or without multiarch support, contains two definitions for each of the __memmove_chk and __memset_chk symbols. /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../i686-pc-linux-gnu/bin/ld: /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset-ia32.o): in function `__memset_chk': /var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/string/../sysdeps/i386/i686/memset.S:32: multiple definition of `__memset_chk'; /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset_chk.o):/var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/debug/../sysdeps/i386/i686/multiarch/memset_chk.c:24: first defined here After this change, regardless of PIC options, the static library, built for i686 with multiarch contains implementations of these functions respectively from debug/memmove_chk.c and debug/memset_chk.c, and without multiarch contains implementations of these functions respectively from sysdeps/i386/memmove_chk.S and sysdeps/i386/memset_chk.S. This ensures that memmove and memset won't pull in __chk_fail and the routines it calls. Reported-by: Sam James Tested-by: Sam James Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch") Signed-off-by: Gabi Falk Reviewed-by: H.J. Lu Reviewed-by: Dmitry V. Levin (cherry picked from commit 5a2cf833f5772d6c37c7adac388dd9af9cc1c4b9) --- sysdeps/i386/i686/memmove.S | 2 +- sysdeps/i386/i686/memset.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S index f230359ad6..effd958120 100644 --- a/sysdeps/i386/i686/memmove.S +++ b/sysdeps/i386/i686/memmove.S @@ -29,7 +29,7 @@ #define SRC DEST+4 #define LEN SRC+4 -#if defined PIC && IS_IN (libc) +#if defined SHARED && IS_IN (libc) ENTRY_CHK (__memmove_chk) movl 12(%esp), %eax cmpl %eax, 16(%esp) diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index f02f5a6df7..ab06771ea0 100644 --- a/sysdeps/i386/i686/memset.S +++ b/sysdeps/i386/i686/memset.S @@ -27,7 +27,7 @@ #define LEN CHR+4 .text -#if defined PIC && IS_IN (libc) +#if defined SHARED && IS_IN (libc) ENTRY_CHK (__memset_chk) movl 12(%esp), %eax cmpl %eax, 16(%esp) -- 2.45.0