Message ID | 20230620181910.1506893-5-fberat@redhat.com |
---|---|
State | Committed |
Commit | 1bc85effd549ae42318b37555a4c76ebc479b92a |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> 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 48827385772A for <patchwork@sourceware.org>; Tue, 20 Jun 2023 18:20:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48827385772A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687285254; bh=974mE53bE4Pr6pcKEPpCOleWdp5BqUrQVzp4DW0pp88=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=HAAoFNWoXVu0GfIxUn5uJ1XT5tQwgdkukmWL5JOGOCUbNjX6Mi1amxyj/dlc9DT7a MESGduznlLL/kC3ib4TeLy8vxgY0h0PVoYFJEFSeqgD1iUGPSHqR1k0l3390r0pyN9 9gwGRu1O0xziMN226Z6f7vZLafTYjnjQKqdVbEos= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 EF5EA385842A for <libc-alpha@sourceware.org>; Tue, 20 Jun 2023 18:19:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF5EA385842A Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-325--C082gfYP_2jGhEui2-LqA-1; Tue, 20 Jun 2023 14:19:33 -0400 X-MC-Unique: -C082gfYP_2jGhEui2-LqA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 829891039638; Tue, 20 Jun 2023 18:19:30 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.39.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBC77112132C; Tue, 20 Jun 2023 18:19:29 +0000 (UTC) To: libc-alpha@sourceware.org Cc: siddhesh@gotplt.org, fberat@redhat.com Subject: [PATCH 04/21] sysdeps/{i386, x86_64}/mempcpy_chk.S: fix linknamespace for __mempcpy_chk Date: Tue, 20 Jun 2023 20:18:52 +0200 Message-ID: <20230620181910.1506893-5-fberat@redhat.com> In-Reply-To: <20230620181910.1506893-1-fberat@redhat.com> References: <20230620181910.1506893-1-fberat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=-12.2 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, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_B=C3=A9rat_via_Libc-alpha?= <libc-alpha@sourceware.org> Reply-To: =?utf-8?b?RnLDqWTDqXJpYyBCw6lyYXQ=?= <fberat@redhat.com> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Allow glibc to be built with _FORTIFY_SOURCE
|
|
Checks
Context | Check | Description |
---|---|---|
redhat-pt-bot/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
Commit Message
Frederic Berat
June 20, 2023, 6:18 p.m. UTC
On i386 and x86_64, for libc.a specifically, __mempcpy_chk calls mempcpy which leads POSIX routines to call non-POSIX mempcpy indirectly. This leads the linknamespace test to fail when glibc is built with __FORTIFY_SOURCE=3. Since calling mempcpy doesn't bring any benefit for libc.a, directly call __mempcpy instead. --- sysdeps/i386/mempcpy_chk.S | 2 +- sysdeps/x86_64/mempcpy_chk.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On 2023-06-20 14:18, Frédéric Bérat wrote: > On i386 and x86_64, for libc.a specifically, __mempcpy_chk calls > mempcpy which leads POSIX routines to call non-POSIX mempcpy indirectly. > > This leads the linknamespace test to fail when glibc is built with > __FORTIFY_SOURCE=3. > > Since calling mempcpy doesn't bring any benefit for libc.a, directly > call __mempcpy instead. > --- LGTM as an independent fix. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> > sysdeps/i386/mempcpy_chk.S | 2 +- > sysdeps/x86_64/mempcpy_chk.S | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S > index 8b785bd9a5..1e9bf71bfb 100644 > --- a/sysdeps/i386/mempcpy_chk.S > +++ b/sysdeps/i386/mempcpy_chk.S > @@ -28,6 +28,6 @@ ENTRY (__mempcpy_chk) > movl 12(%esp), %eax > cmpl %eax, 16(%esp) > jb __chk_fail > - jmp mempcpy > + jmp __mempcpy > END (__mempcpy_chk) > #endif > diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S > index b1ddb02f78..b60ee4ff08 100644 > --- a/sysdeps/x86_64/mempcpy_chk.S > +++ b/sysdeps/x86_64/mempcpy_chk.S > @@ -28,6 +28,6 @@ > ENTRY (__mempcpy_chk) > cmpq %rdx, %rcx > jb __chk_fail > - jmp mempcpy > + jmp __mempcpy > END (__mempcpy_chk) > #endif
On 6/21/23, Siddhesh Poyarekar <siddhesh@gotplt.org> wrote: > > > On 2023-06-20 14:18, Frédéric Bérat wrote: >> On i386 and x86_64, for libc.a specifically, __mempcpy_chk calls >> mempcpy which leads POSIX routines to call non-POSIX mempcpy indirectly. >> >> This leads the linknamespace test to fail when glibc is built with >> __FORTIFY_SOURCE=3. >> >> Since calling mempcpy doesn't bring any benefit for libc.a, directly >> call __mempcpy instead. >> --- > > LGTM as an independent fix. > > Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> > >> sysdeps/i386/mempcpy_chk.S | 2 +- >> sysdeps/x86_64/mempcpy_chk.S | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S >> index 8b785bd9a5..1e9bf71bfb 100644 >> --- a/sysdeps/i386/mempcpy_chk.S >> +++ b/sysdeps/i386/mempcpy_chk.S >> @@ -28,6 +28,6 @@ ENTRY (__mempcpy_chk) >> movl 12(%esp), %eax >> cmpl %eax, 16(%esp) >> jb __chk_fail >> - jmp mempcpy >> + jmp __mempcpy >> END (__mempcpy_chk) >> #endif >> diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S >> index b1ddb02f78..b60ee4ff08 100644 >> --- a/sysdeps/x86_64/mempcpy_chk.S >> +++ b/sysdeps/x86_64/mempcpy_chk.S >> @@ -28,6 +28,6 @@ >> ENTRY (__mempcpy_chk) >> cmpq %rdx, %rcx >> jb __chk_fail >> - jmp mempcpy >> + jmp __mempcpy Does this get the right ifunc (or isa version isa version of built with cpu-specific flags)? >> END (__mempcpy_chk) >> #endif >
On 2023-06-21 13:26, Noah Goldstein wrote: >>> diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S >>> index b1ddb02f78..b60ee4ff08 100644 >>> --- a/sysdeps/x86_64/mempcpy_chk.S >>> +++ b/sysdeps/x86_64/mempcpy_chk.S >>> @@ -28,6 +28,6 @@ >>> ENTRY (__mempcpy_chk) >>> cmpq %rdx, %rcx >>> jb __chk_fail >>> - jmp mempcpy >>> + jmp __mempcpy > > Does this get the right ifunc (or isa version isa version of built > with cpu-specific flags)? It should; __mempcpy is basically an internal alias for mempcpy, which is an ifunc: $ nm /lib64/libc.a | grep "i .*mempcpy" 0000000000000000 i __mempcpy 0000000000000000 i mempcpy Sid
diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S index 8b785bd9a5..1e9bf71bfb 100644 --- a/sysdeps/i386/mempcpy_chk.S +++ b/sysdeps/i386/mempcpy_chk.S @@ -28,6 +28,6 @@ ENTRY (__mempcpy_chk) movl 12(%esp), %eax cmpl %eax, 16(%esp) jb __chk_fail - jmp mempcpy + jmp __mempcpy END (__mempcpy_chk) #endif diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S index b1ddb02f78..b60ee4ff08 100644 --- a/sysdeps/x86_64/mempcpy_chk.S +++ b/sysdeps/x86_64/mempcpy_chk.S @@ -28,6 +28,6 @@ ENTRY (__mempcpy_chk) cmpq %rdx, %rcx jb __chk_fail - jmp mempcpy + jmp __mempcpy END (__mempcpy_chk) #endif