]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: prevent the stack protector from breaking syscall tracing.
authorNick Alcock <nick.alcock@oracle.com>
Thu, 13 Aug 2015 15:47:50 +0000 (16:47 +0100)
committerKris Van Hees <kris.van.hees@oracle.com>
Thu, 13 Aug 2015 16:49:31 +0000 (12:49 -0400)
The systrace_syscall() function is unusual in that it requires %rax to be
conserved in the function prologue (until the volatile asm which collects the
syscall number from it and sticks it in a local variable). GCC doesn't know
about this, and recent GCC has started smashing it with the stack protector
prologue. Fix this by turning off stack protection in this one function (which
does not benefit from it anyway -- it contains only two assignments, neither of
which can overrun -- and is a notable hot spot).

Also declare it asmlinkage, like every other syscall already is: it is called
from asm, just like them.

Orabug: 21630345
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com>
arch/x86/kernel/dtrace_syscall.c

index 21a8dd806a240656116ffe909aa2ce7809922672..d18e638e30fd4c75b3d69035a7333057aa3f9996 100644 (file)
@@ -69,8 +69,12 @@ static systrace_info_t       systrace_info =
                };
 
 
-long systrace_syscall(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
-                     uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
+/*
+ * The stack protector has a tendency to clobber %rax in the prologue.
+ */
+__attribute__((__optimize__("no-stack-protector")))
+asmlinkage long systrace_syscall(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
+                                uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
 {
        long                    rc = 0;
        unsigned long           sysnum;