Do not stack-protect sigreturn stubs [BZ #7065]
authorNick Alcock <nick.alcock@oracle.com>
Mon, 26 Dec 2016 09:09:06 +0000 (10:09 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 26 Dec 2016 09:11:06 +0000 (10:11 +0100)
These are called from the kernel with the stack at a carefully-
chosen location so that the stack frame can be restored: they must not
move the stack pointer lest garbage be restored into the registers.

We explicitly inhibit protection for SPARC and for signal/sigreturn.c:
other arches either define their sigreturn stubs in .S files, or (i386,
x86_64, mips) use macros expanding to top-level asm blocks and explicit
labels in the text section to mock up a "function" without telling the
compiler that one is there at all.

ChangeLog
signal/Makefile
sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c

index 99749a5..edf8523 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 2016-12-26  Nick Alcock  <nick.alcock@oracle.com>
 
        [BZ #7065]
+       * signal/Makefile (CFLAGS-sigreturn.c): Use $(no-stack-protector).
+       * sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c:
+       (__rt_sigreturn_stub): Use inhibit_stack_protector.
+       * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
+       (__rt_sigreturn_stub, __sigreturn_stub): Likewise.
+
+2016-12-26  Nick Alcock  <nick.alcock@oracle.com>
+
+       [BZ #7065]
        * login/Makefile (pt_chown-cflags): Remove.
        * nscd/Makefile (CFLAGS-nscd): Likewise.
        * resolv/Makefile (CFLAGS-libresolv): Likewise.
index 9d29ff4..ccd6f51 100644 (file)
@@ -48,3 +48,5 @@ CFLAGS-sigsuspend.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sigtimedwait.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sigwaitinfo.c = -fexceptions -fasynchronous-unwind-tables
+
+CFLAGS-sigreturn.c = $(no-stack-protector)
index 5aa3c35..b75142f 100644 (file)
@@ -65,7 +65,9 @@ libc_hidden_def (__libc_sigaction)
 #include <nptl/sigaction.c>
 
 
-static void
+static
+inhibit_stack_protector
+void
 __rt_sigreturn_stub (void)
 {
   __asm__ ("mov %0, %%g1\n\t"
@@ -74,7 +76,9 @@ __rt_sigreturn_stub (void)
           : "i" (__NR_rt_sigreturn));
 }
 
-static void
+static
+inhibit_stack_protector
+void
 __sigreturn_stub (void)
 {
   __asm__ ("mov %0, %%g1\n\t"
index 50c444c..058c011 100644 (file)
@@ -66,7 +66,9 @@ libc_hidden_def (__libc_sigaction)
 #include <nptl/sigaction.c>
 
 
-static void
+static
+inhibit_stack_protector
+void
 __rt_sigreturn_stub (void)
 {
   __asm__ ("mov %0, %%g1\n\t"