public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu
@ 2022-11-10  8:36 fweimer at redhat dot com
  2022-11-10  8:44 ` [Bug libc/29770] " fweimer at redhat dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2022-11-10  8:36 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

            Bug ID: 29770
           Summary: prctl does not match manual page ABI on
                    powerpc64le-linux-gnu
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---
            Target: powerpc64le-linux-gnu
             Flags: security-

On powerpc64le-linux-gnu, since

commit ff026950e280bc3e9487b41b460fb31bc5b57721
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Apr 30 10:42:43 2020 -0700

    Add a C wrapper for prctl [BZ #25896]

    Add a C wrapper to pass arguments in

    /* Control process execution.  */
    extern int prctl (int __option, ...) __THROW;

    to prctl syscall:

    extern int prctl (int, unsigned long int, unsigned long int,
                      unsigned long int, unsigned long int);

the glibc ABI no longer matches what is documented in the manual page, which
mentions the second prototype only. Calls through the non-variadic prototype do
not set up a parameter save area, and use of the area by the glibc
implementation corrupts the stack in the caller.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
@ 2022-11-10  8:44 ` fweimer at redhat dot com
  2022-11-10  8:45 ` sam at gentoo dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2022-11-10  8:44 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=107606

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
  2022-11-10  8:44 ` [Bug libc/29770] " fweimer at redhat dot com
@ 2022-11-10  8:45 ` sam at gentoo dot org
  2022-11-10 16:28 ` fweimer at redhat dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2022-11-10  8:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
  2022-11-10  8:44 ` [Bug libc/29770] " fweimer at redhat dot com
  2022-11-10  8:45 ` sam at gentoo dot org
@ 2022-11-10 16:28 ` fweimer at redhat dot com
  2024-02-02 18:38 ` fweimer at redhat dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2022-11-10 16:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |fweimer at redhat dot com

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Patch posted:

[PATCH] Linux: Support non-variadic calls to prctl (bug 29770)
<https://sourceware.org/pipermail/libc-alpha/2022-November/143377.html>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
                   ` (2 preceding siblings ...)
  2022-11-10 16:28 ` fweimer at redhat dot com
@ 2024-02-02 18:38 ` fweimer at redhat dot com
  2024-02-02 18:46 ` fweimer at redhat dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2024-02-02 18:38 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
The libasan interceptor in GCC 11 (and presumably later) uses the non-variadic
prototype, causing crashes on powerpc64le-linux-gnu.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
                   ` (3 preceding siblings ...)
  2024-02-02 18:38 ` fweimer at redhat dot com
@ 2024-02-02 18:46 ` fweimer at redhat dot com
  2024-02-02 21:28 ` fweimer at redhat dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2024-02-02 18:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rajis at linux dot ibm.com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
                   ` (4 preceding siblings ...)
  2024-02-02 18:46 ` fweimer at redhat dot com
@ 2024-02-02 21:28 ` fweimer at redhat dot com
  2024-02-02 21:31 ` fweimer at redhat dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2024-02-02 21:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=113728

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
                   ` (5 preceding siblings ...)
  2024-02-02 21:28 ` fweimer at redhat dot com
@ 2024-02-02 21:31 ` fweimer at redhat dot com
  2024-02-05  9:37 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2024-02-02 21:31 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
Patch reposted:

[PATCH] Linux: Support non-variadic calls to prctl (bug 29770)
<https://inbox.sourceware.org/libc-alpha/87mssir1u6.fsf@oldenburg.str.redhat.com/>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
                   ` (6 preceding siblings ...)
  2024-02-02 21:31 ` fweimer at redhat dot com
@ 2024-02-05  9:37 ` fweimer at redhat dot com
  2024-02-17  8:17 ` cvs-commit at gcc dot gnu.org
  2024-02-17  8:27 ` fweimer at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2024-02-05  9:37 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.redhat.com/b
                   |                            |rowse/RHEL-23472

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
                   ` (7 preceding siblings ...)
  2024-02-05  9:37 ` fweimer at redhat dot com
@ 2024-02-17  8:17 ` cvs-commit at gcc dot gnu.org
  2024-02-17  8:27 ` fweimer at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-17  8:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6a04404521ac4119ae36827eeb288ea84eee7cf6

commit 6a04404521ac4119ae36827eeb288ea84eee7cf6
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sat Feb 17 09:17:04 2024 +0100

    Linux: Switch back to assembly syscall wrapper for prctl (bug 29770)

    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 <simon.chopin@canonical.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libc/29770] prctl does not match manual page ABI on powerpc64le-linux-gnu
  2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
                   ` (8 preceding siblings ...)
  2024-02-17  8:17 ` cvs-commit at gcc dot gnu.org
@ 2024-02-17  8:27 ` fweimer at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2024-02-17  8:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29770

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.40
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
Fixed for 2.40 via:

commit 6a04404521ac4119ae36827eeb288ea84eee7cf6
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sat Feb 17 09:17:04 2024 +0100

    Linux: Switch back to assembly syscall wrapper for prctl (bug 29770)

    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 <simon.chopin@canonical.com>


We can consider backporting.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-17  8:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  8:36 [Bug libc/29770] New: prctl does not match manual page ABI on powerpc64le-linux-gnu fweimer at redhat dot com
2022-11-10  8:44 ` [Bug libc/29770] " fweimer at redhat dot com
2022-11-10  8:45 ` sam at gentoo dot org
2022-11-10 16:28 ` fweimer at redhat dot com
2024-02-02 18:38 ` fweimer at redhat dot com
2024-02-02 18:46 ` fweimer at redhat dot com
2024-02-02 21:28 ` fweimer at redhat dot com
2024-02-02 21:31 ` fweimer at redhat dot com
2024-02-05  9:37 ` fweimer at redhat dot com
2024-02-17  8:17 ` cvs-commit at gcc dot gnu.org
2024-02-17  8:27 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).