Re: [PATCH v3 2/4] x86/syscalls: Specific usage of verify_pre_usermode_state
From: Thomas Garnier <hidden>
Date: 2017-03-22 20:41:54
On Wed, Mar 22, 2017 at 1:21 PM, H. Peter Anvin [off-list ref] wrote:
On 03/22/17 12:15, Thomas Garnier wrote:quoted
On Wed, Mar 15, 2017 at 10:43 AM, Thomas Garnier [off-list ref] wrote:quoted
Thanks for the feedback. I will look into inlining by default (looking at code size on different arch), the updated patch for x86 in the meantime:I did couple checks and it doesn't seem worth it. I will send a v4 with the change below for additional feedback.Can you specify what that means?
If I set inline by default, the compiler chose not to inline it on x86. If I force inline the size impact was actually bigger (without the architecture specific code).
On x86, where there is only one caller of this, it really seems like it ought to reduce the overhead to almost zero (since it most likely is hidden in the pipeline.) I would like to suggest defining it inline if CONFIG_ARCH_NO_SYSCALL_VERIFY_PRE_USERMODE_STATE is set; I really don't care about an architecture which doesn't have it.
But if there is only one caller, does the compiler is not suppose to inline the function based on options? The assembly will call it too, so I would need an inline and a non-inline based on the caller.
Note that the upcoming 5-level paging (LA57) support will make
TASK_SIZE_MAX dependent on the CPU. The best way to handle that is
probably to tag this immediate with an assembly alternative rather than
loading it from a memory variable (most likely taking a cache hit.)
-hpa-- Thomas