[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180409063921.wkrqbnv4lzxb3isg@gmail.com>
Date: Mon, 9 Apr 2018 08:39:21 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Dominik Brodowski <linux@...inikbrodowski.net>
Cc: linux-kernel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
Andi Kleen <ak@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Brian Gerst <brgerst@...il.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
Maninder Singh <maninder1.s@...sung.com>,
Arnd Bergmann <arnd@...db.de>,
linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 0/3] syscalls: clean up stub naming convention
* Dominik Brodowski <linux@...inikbrodowski.net> wrote:
> > One more fundamental question: why do we have the __do_sys_waitid() and
> > __inline_sys_waitid() distinction - aren't the function call signatures the same
> > with no conversion done?
> >
> > I.e. couldn't we just do a single, static __do_sys_waitid(), where the compiler
> > would decide to what extent inlining is justified? This would allow the compiler
> > to inline all the intermediate code into the stubs themselves.
> >
> > Or is this a side effect of the error injection feature, which needs to add extra
> > logic at this intermediate level? That too should be able to use the
> > __do_sys_waitid() variant though.
>
> Error injection is unrelated. It seems to be for three reasons, if I read
> the code (include/linux/syscalls.h) correctly:
>
> asmlinkage long __do_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))
>
> 1) This takes arguments of type long (to protect against CVE-2009-0029);
> see https://lwn.net/Articles/604287/ : "Digging into the history of
> this, it turns out that the long version ensures that 32-bit values
> are correctly sign-extended for some 64-bit kernel platforms,
> preventing a historical vulnerability."
>
> {
> long ret = __in_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));
> __MAP(x,__SC_TEST,__VA_ARGS__);
I see - so it's _not_ the same function call signature, but a wrapper with a
sign-extended version, which is fair and useful. So on architectures where this
matters there's type conversion and active code generated.
Thanks,
Ingo
Powered by blists - more mailing lists