[kernel-hardening] Re: [PATCH v3 2/4] x86/syscalls: Specific usage of verify_pre_usermode_state

H. Peter Anvin
2017-03-14T17:53:36Z

On 03/14/17 09:51, Thomas Garnier wrote:
>>
>> I wanted to comment on that thing: why on earth isn't
>> verify_pre_usermode_state() an inline? Making it an out-of-line
>> function adds pointless extra overhead to the C code when we are talking
>> about a few instructions.
>
> Because outside of arch specific implementation it is called by each
> syscall handler. it will increase the code size a lot.
>

Don't assume that. On a lot of architectures a function call can be
more expensive than a simple compare and branch, because the compiler
has to assume a whole bunch of registers are lost at that point.

Either way, don't penalize the common architectures for it. Not okay.

-hpa