lkml.org 
[lkml]   [2018]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/3] syscalls: clean up stub naming convention
* Dominik Brodowski <linux@dominikbrodowski.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

\
 
 \ /
  Last update: 2018-04-09 08:40    [W:0.122 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site