[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMe9rOrt5hz6qsNAxPgdKCOhRcKKESv-D3rxdSfraeJ-LFHM4w@mail.gmail.com>
Date: Thu, 27 Aug 2020 18:44:27 -0700
From: "H.J. Lu" <hjl.tools@...il.com>
To: Andy Lutomirski <luto@...nel.org>
Cc: "Yu, Yu-cheng" <yu-cheng.yu@...el.com>,
Florian Weimer <fweimer@...hat.com>,
Dave Martin <Dave.Martin@....com>,
Dave Hansen <dave.hansen@...el.com>, X86 ML <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
linux-arch <linux-arch@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
Balbir Singh <bsingharora@...il.com>,
Borislav Petkov <bp@...en8.de>,
Cyrill Gorcunov <gorcunov@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Eugene Syromiatnikov <esyr@...hat.com>,
Jann Horn <jannh@...gle.com>, Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Nadav Amit <nadav.amit@...il.com>,
Oleg Nesterov <oleg@...hat.com>, Pavel Machek <pavel@....cz>,
Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...el.com>,
Weijiang Yang <weijiang.yang@...el.com>
Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for
shadow stack
On Thu, Aug 27, 2020 at 6:35 PM Andy Lutomirski <luto@...nel.org> wrote:
>
> On Thu, Aug 27, 2020 at 12:38 PM H.J. Lu <hjl.tools@...il.com> wrote:
> >
> > On Thu, Aug 27, 2020 at 11:56 AM Andy Lutomirski <luto@...capital.net> wrote:
> > >
> > >
> > >
> > > > On Aug 27, 2020, at 11:13 AM, Yu, Yu-cheng <yu-cheng.yu@...el.com> wrote:
> > > >
> > > > On 8/27/2020 6:36 AM, Florian Weimer wrote:
> > > >> * H. J. Lu:
> > > >>>> On Thu, Aug 27, 2020 at 6:19 AM Florian Weimer <fweimer@...hat.com> wrote:
> > > >>>>>
> > > >>>>> * Dave Martin:
> > > >>>>>
> > > >>>>>> You're right that this has implications: for i386, libc probably pulls
> > > >>>>>> more arguments off the stack than are really there in some situations.
> > > >>>>>> This isn't a new problem though. There are already generic prctls with
> > > >>>>>> fewer than 4 args that are used on x86.
> > > >>>>>
> > > >>>>> As originally posted, glibc prctl would have to know that it has to pull
> > > >>>>> an u64 argument off the argument list for ARCH_X86_CET_DISABLE. But
> > > >>>>> then the u64 argument is a problem for arch_prctl as well.
> > > >>>>>
> > > >>>
> > > >>> Argument of ARCH_X86_CET_DISABLE is int and passed in register.
> > > >> The commit message and the C source say otherwise, I think (not sure
> > > >> about the C source, not a kernel hacker).
> > > >
> > > > H.J. Lu suggested that we fix x86 arch_prctl() to take four arguments, and then keep MMAP_SHSTK as an arch_prctl(). Because now the map flags and size are all in registers, this also solves problems being pointed out earlier. Without a wrapper, the shadow stack mmap call (from user space) will be:
> > > >
> > > > syscall(_NR_arch_prctl, ARCH_X86_CET_MMAP_SHSTK, size, MAP_32BIT).
> > >
> > > I admit I don’t see a show stopping technical reason we can’t add arguments to an existing syscall, but I’m pretty sure it’s unprecedented, and it doesn’t seem like a good idea.
> >
> > prctl prototype is:
> >
> > extern int prctl (int __option, ...)
> >
> > and implemented in kernel as:
> >
> > int prctl(int option, unsigned long arg2, unsigned long arg3,
> > unsigned long arg4, unsigned long arg5);
> >
> > Not all prctl operations take all 5 arguments. It also applies
> > to arch_prctl. It is quite normal for different operations of
> > arch_prctl to take different numbers of arguments.
>
> If by "quite normal" you mean "does not happen", then I agree.
>
> In any event, I will not have anything to do with a patch that changes
> an existing syscall signature unless Linus personally acks it. So if
> you want to email him and linux-abi, be my guest.
Can you think of ANY issues of passing more arguments to arch_prctl?
syscall () provided by glibc always passes 6 arguments to the kernel.
Arguments are already in the registers. What kind of problems do
you see?
--
H.J.
Powered by blists - more mailing lists