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.133.124]) by sourceware.org (Postfix) with ESMTPS id 2A22C3858C33 for ; Fri, 2 Feb 2024 21:30:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A22C3858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A22C3858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706909435; cv=none; b=MGir3WJRG+KH8fqom6ryvus3bFhaIOnokGakzfDFoVK78zLc/VaBUakS7dBXXOXDKblDMAt6knuHCR5CGqrdZrI08v3gavFPgUnmYBJXBWhPFLqom+30gGeQVQmMkwNC+jn/fKpRT46bAUjrJ4esrPSQCqmaIYQIKBFGX6YJISg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706909435; c=relaxed/simple; bh=Q47HCg9i270FpZO1JppIQyXYKtH0yE6tj6qHzwqnSLY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bNMXNNoH8gw6jp2wwk7alr/LjDhE/AqaB1NqCUhrnElwRagiUzw7bLJlmYwFSa5U2kmx/1wNY+VW9vc4qklBqqBKVj7xKUZXUdicJawcq3KgwecPCjEhXGER5JEB3eP/29D++AuQ6RtBRe951oDyXUsRE1JKKdyoy+gYdrI9KCY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706909432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=KAD2eI9k31I1RWW+JsMk7LZTn7q1aA7IaTaHEds2f7k=; b=QeKTecZLLaWyUVOeqIcEEpLDwfn7WFINDA1NvtEKpDsPNTwQaHETHtIm0v2ZbsSkKPmMbL L4My/MpJ0xUgYdDarx5akihfyWmKFpXRfn359GtN2hegumlaAQESS3YXauzGxDEEZgNHtZ 5D3TA6nVY+APrhLpO+zcr8Q1YrWD1ag= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-p509P-O7NoCAiFy8I2ZPEw-1; Fri, 02 Feb 2024 16:30:31 -0500 X-MC-Unique: p509P-O7NoCAiFy8I2ZPEw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FCE23806704 for ; Fri, 2 Feb 2024 21:30:31 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D88BA2166B33 for ; Fri, 2 Feb 2024 21:30:30 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] Linux: Switch back to assembly syscall wrapper for prctl (bug 29770) Date: Fri, 02 Feb 2024 22:30:25 +0100 Message-ID: <87mssir1u6.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 List-Id: Commit ff026950e280bc3e9487b41b460fb31bc5b57721 ("Add a C wrapper for prctl [BZ #25896]") replaced the assembler wrapper with a C function. However, the C variadic function implementation has a different ABI on powerpc64le-linux-gnu. Switch back to the assembler implementation on most targets and only keep the C implementation for x86-64 x32. Also add the __prctl_time64 alias from commit b39ffab860cd743a82c91946619f1b8158b0b65e ("Linux: Add time64 alias for prctl") to sysdeps/unix/sysv/linux/syscalls.list; it was not yet present in commit ff026950e280bc3e9487b41b460fb31bc5b57721. This restores the old ABI on powerpc64le-linux-gnu, thus fixing bug 29770. Notes: This is just a repost of my previous patch. I still think it is the right thing to do. We now have a second case where the varargs implementation causes stack corruption on powerpc64le-linux-gnu. This time it's the libasan interceptor for prctl: libasan uses incorrect prctl prototype Thanks, Florian --- sysdeps/unix/sysv/linux/syscalls.list | 1 + sysdeps/unix/sysv/linux/{ => x86_64/x32}/prctl.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 73e941ef89..9ac42c3436 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -46,6 +46,7 @@ open_tree EXTRA open_tree i:isU open_tree pipe2 - pipe2 i:fi __pipe2 pipe2 pidfd_open EXTRA pidfd_open i:iU pidfd_open pidfd_getfd EXTRA pidfd_getfd i:iiU pidfd_getfd +prctl EXTRA prctl i:iiiii __prctl prctl __prctl_time64 pivot_root EXTRA pivot_root i:ss pivot_root pidfd_send_signal EXTRA pidfd_send_signal i:iiPU pidfd_send_signal process_madvise EXTRA process_madvise i:iPniU process_madvise diff --git a/sysdeps/unix/sysv/linux/prctl.c b/sysdeps/unix/sysv/linux/x86_64/x32/prctl.c similarity index 93% rename from sysdeps/unix/sysv/linux/prctl.c rename to sysdeps/unix/sysv/linux/x86_64/x32/prctl.c index 52d234ea0d..4bf1b479a0 100644 --- a/sysdeps/unix/sysv/linux/prctl.c +++ b/sysdeps/unix/sysv/linux/x86_64/x32/prctl.c @@ -1,4 +1,4 @@ -/* prctl - Linux specific syscall. +/* prctl - Linux specific syscall. x86-64 x32 version. Copyright (C) 2020-2024 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -40,6 +40,3 @@ __prctl (int option, ...) libc_hidden_def (__prctl) weak_alias (__prctl, prctl) -#if __TIMESIZE != 64 -weak_alias (__prctl, __prctl_time64) -#endif base-commit: 7c8df0b9441e34928f2d7d70531e3d55e016c32e