From: Peter Oskolkov <posk@google.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
Andy Lutomirski <luto@kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-toolchains@vger.kernel.org
Subject: Re: Is adding an argument to an existing syscall okay?
Date: Tue, 17 Nov 2020 10:58:49 -0800 [thread overview]
Message-ID: <CAPNVh5d2u84t9RV7kg6PYJc5eGFrEQV__aDX6AC2V4-s+msFvA@mail.gmail.com> (raw)
In-Reply-To: <87r1or4yct.fsf@mid.deneb.enyo.de>
My assumption here was that applications that are aware of the new API
will always provide three parameters, while older applications will
continue calling the syscall with two.
I can't think of a situation/architecture where this will break anything.
Thanks,
Peter
On Tue, Nov 17, 2020 at 10:44 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * Segher Boessenkool:
>
> > But this isn't variadic in the sense of "..." -- on Power that always
> > passes the unspecified arguments in memory, while in this case it just
> > passes in either two or three registers. I don't know any arg where
> > that would not work, given the Linux system call restrictions.
> >
> > This is similar to the "open" system call.
>
> Exactly. You cannot call the open function through a non-variadic
> function pointer. I've seen it cause stack corruption in practice:
>
> commit c7774174beffe9a8d29dd4fb38bbed43ece1cecd
> Author: Andreas Schneider <asn@samba.org>
> Date: Wed Aug 2 13:21:59 2017 +0200
>
> swrap: Fix prototype of open[64] to prevent segfault on ppc64le
>
> The calling conventions for vaarg are different on ppc64le. The patch
> fixes segfaults on that platform.
>
> Thanks to Florian Weimer who helped debugging it!
>
> Signed-off-by: Andreas Schneider <asn@samba.org>
> Reviewed-by: Stefan Metzmacher <metze@samba.org>
>
> <https://git.samba.org/?p=socket_wrapper.git;a=commitdiff;h=c7774174beffe>
>
> It is possible to implement the open function in such a way that it
> does not have this problem (simply do not use the parameter save area,
> using assembler if necessary), but it's another obscure step that libc
> implementers would have to take.
next prev parent reply other threads:[~2020-11-17 18:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 23:57 Is adding an argument to an existing syscall okay? Andy Lutomirski
2020-11-17 14:28 ` Mathieu Desnoyers
2020-11-17 17:05 ` Theodore Y. Ts'o
2020-11-17 17:16 ` Florian Weimer
2020-11-17 18:36 ` Segher Boessenkool
2020-11-17 18:44 ` Florian Weimer
2020-11-17 18:58 ` Peter Oskolkov [this message]
2020-11-17 19:21 ` Mathieu Desnoyers
2020-11-17 19:32 ` Peter Oskolkov
2020-11-17 19:45 ` Florian Weimer
2020-11-19 3:08 ` Aleksa Sarai
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=CAPNVh5d2u84t9RV7kg6PYJc5eGFrEQV__aDX6AC2V4-s+msFvA@mail.gmail.com \
--to=posk@google.com \
--cc=fw@deneb.enyo.de \
--cc=linux-api@vger.kernel.org \
--cc=linux-toolchains@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=peterz@infradead.org \
--cc=segher@kernel.crashing.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 NNTP newsgroup(s).