From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Linux: Support non-variadic calls to prctl (bug 29770)
Date: Thu, 10 Nov 2022 21:08:43 +0100 [thread overview]
Message-ID: <878rkishbo.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOoSDnQo2Uea95LAo_OD_mLLU0HJUsYASsxy4UAstqcyVA@mail.gmail.com> (H. J. Lu's message of "Thu, 10 Nov 2022 11:55:22 -0800")
* H. J. Lu:
> On Thu, Nov 10, 2022 at 11:18 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu:
>>
>> > prctl is an exported variadic function. Do we need to keep it?
>>
>> Do you mean whether we should keep it as a variadic function or turn it
>> into a function with a fixed argument list?
>
> Yes.
>
>> Unfortunately the types and number of arguments vary between the
>> sub-operations. Pretty much any application calling prctl would have to
>> be changed. It's just syscall by another name (and with a fixed number
>> of course).
>>
>
> <sys/prctl.h> has
>
> extern int prctl (int __option, ...) __THROW;
>
> Your change works for
>
> int prctl(int option, unsigned long arg2, unsigned long arg3,
> unsigned long arg4, unsigned long arg5);
>
> prtcl (...);
>
> But it breaks
>
> #include <sys/prctl.h>
>
> prctl (...);
I don't think that's true for our current ABIs. They support
unprototyped calls, and by extension this also means that calls through
a variadic prototype to a prototyped non-variadic function must work as
well. There are other ABIs which do not work this way, but glibc hasn't
been ported to them (and it's unclear how useful they would be for
GNU/Linux).
The new C implementation is equivalent to the previous assembler
implementation.
Thanks,
Florian
next prev parent reply other threads:[~2022-11-10 20:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 16:07 Florian Weimer
2022-11-10 18:43 ` H.J. Lu
2022-11-10 19:18 ` Florian Weimer
2022-11-10 19:55 ` H.J. Lu
2022-11-10 20:08 ` Florian Weimer [this message]
2022-11-11 13:27 ` Szabolcs Nagy
2023-09-04 14:46 ` Florian Weimer
2023-09-04 16:37 ` Szabolcs Nagy
2022-11-10 20:34 ` H.J. Lu
2022-11-10 20:41 ` Florian Weimer
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=878rkishbo.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/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).