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>
};
-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;