From patchwork Wed Feb 14 15:55:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 85739 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 6E893385803D for ; Wed, 14 Feb 2024 15:55:37 +0000 (GMT) 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 F3874385840C for ; Wed, 14 Feb 2024 15:55:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F3874385840C 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 F3874385840C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707926117; cv=none; b=ZL65cJ+BLPgdZHLYoJoz1tA65SO/Rtqtu3OFqvdg4xUTFvZVWMbizU8I/33yGyf4oXjxqbL8hk7JqK7xaORJOLNUjPERu2RY5Mkt6qRWC8HppxQ/+ycriosW3QBiw5Pbg96SIxmsYYTVhCtm6RSA51rEEur+PP/HaBBVnP9I/4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707926117; c=relaxed/simple; bh=Licki5urrt9mPrbkWI+P+RRezu/Z978pC1Czeoq0E0Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vqf8pGzo3CzE2rCyEUf4x3K9NwLh86twsLTP4rXqpFbCcXxKAcQfryGG1Sp0jGorXKw7FC+2aqsvEyKdKF1tS972HqEbv04y5d++GWpWEEf6s8hzEPCKqq1en5WFpBrXiYQmCQjH4k7WZWVN+vJMkE99K4nHlEUJFnY+IF5P3aQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707926114; 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; bh=/A1a5K+2tHg1VqOFqdb1G6W1TFesJ4KuMLUMhD5x0z8=; b=H7k7SzUul0LfOcqKZ8qwb1P6s2YFZvDvUl4obYpxT4KQ2HfonNvWz3S5k0TpLY/9rMJZg3 HMqQQh99YwoMl7/URfyPXa1g4jrEC9B7Yj9llFkHtS9mM7pj6iPfgr5tXXwqzLRYn5sPbw poC1/BbpVEH+FCayJ01Y0fsVFargLwA= 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-191-zCN9a1ygN_iMGtTDChoTSg-1; Wed, 14 Feb 2024 10:55:13 -0500 X-MC-Unique: zCN9a1ygN_iMGtTDChoTSg-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 198EB3816B4B; Wed, 14 Feb 2024 15:55:13 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 048C12166B32; Wed, 14 Feb 2024 15:55:11 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Cc: Rajalakshmi Srinivasaraghavan , Simon Chopin , Andreas Schwab , bergner@linux.ibm.com Subject: [PATCH v3] Linux: Switch back to assembly syscall wrapper for prctl (bug 29770) Date: Wed, 14 Feb 2024 16:55:10 +0100 Message-ID: <874jebdorl.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 X-Spam-Status: No, score=-11.1 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_H2, 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.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 ff026950e280bc3e9487b41b460fb31bc5b57721 ("Add a C wrapper for prctl [BZ #25896]") replaced the assembler wrapper with a C function. However, on powerpc64le-linux-gnu, the C variadic function implementation requires extra work in the caller to set up the parameter save area. Calling a function that needs a parameter save area without one (because the prototype used indicates the function is not variadic) corrupts the caller's stack. The Linux manual pages project documents prctl as a non-variadic function. This has resulted in various projects over the years using non-variadic prototypes, including the sanitizer libraries in LLVm and GCC (GCC PR 113728). This commit switches back to the assembler implementation on most targets and only keeps 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. Reviewed-By: Simon Chopin --- v3: Commit message updated. sysdeps/unix/sysv/linux/syscalls.list | 1 + sysdeps/unix/sysv/linux/{ => x86_64/x32}/prctl.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) base-commit: 491e55beab7457ed310a4a47496f4a333c5d1032 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