From patchwork Tue Apr 30 20:05:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabi Falk X-Patchwork-Id: 89206 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 53B23384AB58 for ; Tue, 30 Apr 2024 20:06:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by sourceware.org (Postfix) with ESMTPS id 6BEA83858D1E for ; Tue, 30 Apr 2024 20:05:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6BEA83858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6BEA83858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.227.17.22 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714507544; cv=none; b=uxWbwrxZHwi0oEYWhfFUozXj3VP19Ymw8gZ9o5BJMGGIrMMO+UocNU6Y5VARyD5VDQM8vFwdvfBy4lYI1mq+Q00kw3eWB3yjg5V2PI53/qLXP5dOAD+iX2KwcbU3TndrSShZWPmNEftQiKSbT0SCk55DEsWYXWUDZxi/OU0gfcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714507544; c=relaxed/simple; bh=zAIgAHhgGOo+N4Lu0lvyx7H6ZotxQo4sbNiTm76M8Jg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rnE8jIK1R/S0GJChqg10ku8uZlAAUlSC36yCwyc8TAQFZ1S3kq15N6tecAKxej/C4spTN4yPQ4/ap+I6dL4LfQZS8W8PBbgc3aErx57NET+VHo7Y7P9roJTBMQ6iiOAzL8ry1qVF4ft3O1Fx7HdQ0r6MO0RlnML9h/1KFeziMtQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.com; s=s31663417; t=1714507523; x=1715112323; i=gabifalk@gmx.com; bh=jGrB3U2SObtCufsPS40KLhHrFwTqfYI+nRqPa1UdsSU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=k4XYknydWy2tBmWheT6yn4/S6xUu6KKCZALfyfAj085uYAnwMNnL288tlmklDTrA RTeZkbsFsUG3EjDtd3e/LSYdq+EC4QUG/leSr60rgLAR+4nCMXEWPxNaZLRlFngMm 4syC2FwY/QGzih20VZl2rbROJMmxWvjMYQxmASsZZtTv1LNv1mHuKeW3XivQ0NZjM XRI/gc+K7d2NrHrZ9Kt8avD6Hp1wB7fIwAXrbvLAoyBJQPef1oG78Yw5e0KAAnkAN /RWlfk6MQuPWlHvoRw7Ibqm/gYnb7Cea3p1+yD4APIqjcRcdA/tcxmnu2KuO9u1Q6 pNGZUbSEoFBtoLEVHQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost ([46.120.23.13]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M2O2Q-1s5jTx0r9C-002Ljn; Tue, 30 Apr 2024 22:05:23 +0200 From: Gabi Falk To: libc-alpha@sourceware.org, "H.J. Lu" , Florian Weimer , "Dmitry V. Levin" , Sam James Cc: Gabi Falk Subject: [PATCH 2/3] i686: Fix multiple definitions of __memmove_chk and __memset_chk Date: Tue, 30 Apr 2024 20:05:03 +0000 Message-ID: <20240430200506.2717717-3-gabifalk@gmx.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240430200506.2717717-1-gabifalk@gmx.com> References: <20240430200506.2717717-1-gabifalk@gmx.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:rq3XQYr2HBjKW985kdYWvMwATQH0l4tXSjfiHcjP9Oad0Rs+GOJ SYDcxGe1NNobTpXzp/2yqrR01jVqmJIVXraqwJ4a7iRjVUw2mwCh+SqnPW8KPoctqbwMBeQ veOdq3ox6tWBUo+UDizsYUAIwxPo4Av44yTu3fE/VzEf8+DZo0QhP2xKgjSs6EGqsy/qf0r ZIDlTZDDX/s+vMJjlXQkQ== UI-OutboundReport: notjunk:1;M01:P0:3CWDGtCnY3Y=;L7lJlaQo5emLyI+F/Hipkq8F2Gk jKJD3b5etAUS/Hi3NzbrjyAHu8R9jAkt+9/GUuy4jHxAgh1n3oehZwqD5elDxljQQYPuLUVxx LhMNi4IBs2MGZbqH4sBSUPp9S85utuVJ5Bh9mghHYLyrJo3qjhoN0mdirbe4YOG1etOZzAT+B AR2cuSyKv/TZRnpRf/Wdf0g7jSH4o3P4gIBDgIPa49bgVJUW7CycYnIh/YdComDW5rtbHUQaX 8OxlY7dhdkpNqhNU0ZIhNiWUKK7j53kWQ3Q8c+A1rtrOV+wY/HkNYq0g7OdvmbK9CpdJ+K/qE YkOwUD2I9xtkKNcKrWeLSeVR+D3mTHHmjUGX/DMInRXzvqO852p86nKF1SHJe+vq6L3FZT6eS key4oT/ZXxzXI9mLma9ftGFu6lRQlArTGu2LWWhzK21EgLgHkqpvq3VCzArYjiTWsf6TaoFCA Q9MLSQFPFyOX+e77g0L2kQTmBe27lMwvTraNRatHdrwLpUcRGEBL1Gfkcbc40do+Cz0s0HjAP LY+ju0w+9X69km684Xo00ADcNbblFTdtDi0IhhxN5cHi0ZrOtU9VdHTFzDxxZ+uv/2AiXItMB lbjmB1UJvsv9L5wxaU5wCoTviU0O7fWO28LFyrN/eZ5aKCArM21JgVJ0praC51Fq46RC1Ae2i tbUPHtSTOwOhECN5YRCHkTuqLv6oglu4VbibpuVANT1vxwVSKBGwRPueOe+bVh32dR+ojXK6d aJk27sPocofr1RNyD9jAZsZzJbwIZULhyG90RALYpU7/a7UVywu+UkGx1eixAL+VUrNuQ55o7 2zBDEjO6L4LMul1us6oTdI/paMZ/glw2TihqVC6Tk6Zj4= X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org 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 Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch") Signed-off-by: Gabi Falk Reviewed-by: H.J. Lu Reviewed-by: H.J. Lu --- sysdeps/i386/i686/memmove.S | 2 +- sysdeps/i386/i686/memset.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- gabi 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)