Thread (1 message) 1 message, 1 author, 2017-03-23

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

From: H. Peter Anvin <hidden>
Date: 2017-03-23 19:14:56

Weisbecker [off-list ref],Stanislav Kinsburskiy [off-list ref],Ingo Molnar [off-list ref],Paolo Bonzini [off-list ref],Dmitry Safonov [off-list ref],Borislav Petkov [off-list ref],Josh Poimboeuf [off-list ref],Brian Gerst [off-list ref],Jan Beulich [off-list ref],Christian Borntraeger [off-list ref],Fenghua Yu [off-list ref],He Chen [off-list ref],Russell King [off-list ref],Vladimir Murzin [off-list ref],Will Deacon [off-list ref],Catalin Marinas [off-list ref],Mark Rutland [off-list ref],James Morse [off-list ref],"David A . Long" [off-list ref],Pratyush Anand [off-list ref],Laura Abbott [off-list ref],Andre Przywara <andre.przywara
 @arm.com>,Chris Metcalf [off-list ref],linux-s390 [off-list ref],LKML [off-list ref],Linux API [off-list ref],the arch/x86 maintainers
[off-list ref],"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" [off-list ref],Kernel Hardening [off-list ref]
From: hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org
Message-ID: [off-list ref]

On March 22, 2017 2:11:12 PM PDT, Thomas Garnier [off-list ref] wrote:
On Wed, Mar 22, 2017 at 1:49 PM, H. Peter Anvin [off-list ref] wrote:
quoted
On 03/22/17 13:41, Thomas Garnier wrote:
quoted
quoted
quoted
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).
That's utterly bizarre.  Something strange is going on there.  I
suspect
quoted
the right thing to do is to out-of-line the error case only, but even
that seems strange.  It should be something like four instructions
inline.
quoted
The compiler seemed to often inline other functions called by the
syscall handlers. I assume the growth was due to changes in code
optimization because the function is much larger at the end.
quoted
quoted
quoted
On x86, where there is only one caller of this, it really seems
like it
quoted
quoted
quoted
ought to reduce the overhead to almost zero (since it most likely
is
quoted
quoted
quoted
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
quoted
quoted
quoted
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?
If it is marked static in the same file, yes, but you have it in a
different file from what I can tell.
If we do global optimization, it should. Having it as a static inline
make it easier on all types of builds.
quoted
quoted
The assembly will call it too, so I would need an inline and a
non-inline based on the caller.
Where?  I don't see that anywhere, at least for x86.
After the latest changes on x86, yes. On arm/arm64, we call it with
the CHECK_DATA_CORRUPTION config.
quoted
        -hpa
If we do global optimization, yes, but global optimization (generally called link-time optimization, LTO, on Linux) is very much the exception and not the rule for the Linux kernel at this time.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help