From: Florian Weimer <fweimer@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Simon Chopin <simon.chopin@canonical.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] Linux: Switch back to assembly syscall wrapper for prctl (bug 29770)
Date: Tue, 13 Feb 2024 13:24:42 +0100 [thread overview]
Message-ID: <87a5o4imb9.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <mvma5o41s1r.fsf@suse.de> (Andreas Schwab's message of "Tue, 13 Feb 2024 13:12:48 +0100")
* Andreas Schwab:
> On Feb 13 2024, Florian Weimer wrote:
>
>> “
>> 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. Switch back to the assembler
>> implementation on most targets and only keep the C implementation for
>> x86-64 x32.
>> ”
>
> That does not explain why the compiler did not set up the parameter save
> area even though the declaration in <sys/prctl.h> is varadic. Do I
> understand correctly that some software uses a private declaration that
> is prototyped but non-variadic?
Yes, GCC and LLVM upstream contain an unprototyped prctl function
declaration somewhere:
libasan uses incorrect prctl prototype
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113728>
This is not the only piece of software with this problem. It's easier
to fix this in glibc than to figure out how to change the libasan
sanitizer to change the prototype there, so that's why I prefer this
approach.
Thanks,
Florian
next prev parent reply other threads:[~2024-02-13 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 21:30 Florian Weimer
2024-02-13 11:35 ` Simon Chopin
2024-02-13 11:54 ` Florian Weimer
2024-02-13 12:12 ` Andreas Schwab
2024-02-13 12:24 ` Florian Weimer [this message]
2024-02-13 12:40 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a5o4imb9.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=schwab@suse.de \
--cc=simon.chopin@canonical.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).