introduce generic sys_sigaltstack(), switch x86 and um to it
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 14 Dec 2012 19:09:47 +0000 (14:09 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 19 Dec 2012 23:07:40 +0000 (18:07 -0500)
Conditional on CONFIG_GENERIC_SIGALTSTACK; architectures that do not
select it are completely unaffected

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 files changed:
arch/Kconfig
arch/um/kernel/signal.c
arch/x86/Kconfig
arch/x86/include/asm/syscalls.h
arch/x86/kernel/entry_32.S
arch/x86/kernel/entry_64.S
arch/x86/kernel/signal.c
arch/x86/syscalls/syscall_32.tbl
arch/x86/syscalls/syscall_64.tbl
arch/x86/um/Kconfig
arch/x86/um/sys_call_table_32.c
arch/x86/um/sys_call_table_64.c
include/linux/syscalls.h
kernel/signal.c

index 0a8dd05..3301768 100644 (file)
@@ -335,6 +335,9 @@ config MODULES_USE_ELF_REL
          Modules only use ELF REL relocations.  Modules with ELF RELA
          relocations will give an error.
 
+config GENERIC_SIGALTSTACK
+       bool
+
 #
 # ABI hall of shame
 #
index db18eb6..48ccf71 100644 (file)
@@ -132,8 +132,3 @@ long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
        siginitset(&blocked, mask);
        return sigsuspend(&blocked);
 }
-
-long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
-{
-       return do_sigaltstack(uss, uoss, PT_REGS_SP(&current->thread.regs));
-}
index 01ca0eb..f380614 100644 (file)
@@ -111,6 +111,7 @@ config X86
        select MODULES_USE_ELF_REL if X86_32
        select MODULES_USE_ELF_RELA if X86_64
        select CLONE_BACKWARDS if X86_32
+       select GENERIC_SIGALTSTACK
 
 config INSTRUCTION_DECODER
        def_bool y
index 2f83747..58b7e3e 100644 (file)
@@ -25,9 +25,6 @@ asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
 
 /* kernel/signal.c */
 long sys_rt_sigreturn(struct pt_regs *);
-long sys_sigaltstack(const stack_t __user *, stack_t __user *,
-                    struct pt_regs *);
-
 
 /* kernel/tls.c */
 asmlinkage int sys_set_thread_area(struct user_desc __user *);
index c763116..ff84d54 100644 (file)
@@ -739,7 +739,6 @@ ENTRY(ptregs_##name) ; \
 ENDPROC(ptregs_##name)
 
 PTREGSCALL1(iopl)
-PTREGSCALL2(sigaltstack)
 PTREGSCALL0(sigreturn)
 PTREGSCALL0(rt_sigreturn)
 PTREGSCALL2(vm86)
index 2363e82..6e46201 100644 (file)
@@ -864,7 +864,6 @@ END(stub_\func)
        FORK_LIKE  clone
        FORK_LIKE  fork
        FORK_LIKE  vfork
-       PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx
        PTREGSCALL stub_iopl, sys_iopl, %rsi
 
 ENTRY(ptregscall_common)
index 70b27ee..16d065c 100644 (file)
@@ -602,13 +602,6 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
 }
 #endif /* CONFIG_X86_32 */
 
-long
-sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
-               struct pt_regs *regs)
-{
-       return do_sigaltstack(uss, uoss, regs->sp);
-}
-
 /*
  * Do a signal return; undo the signal stack.
  */
index ee3c220..62c7b22 100644 (file)
 183    i386    getcwd                  sys_getcwd
 184    i386    capget                  sys_capget
 185    i386    capset                  sys_capset
-186    i386    sigaltstack             ptregs_sigaltstack              stub32_sigaltstack
+186    i386    sigaltstack             sys_sigaltstack                 stub32_sigaltstack
 187    i386    sendfile                sys_sendfile                    sys32_sendfile
 188    i386    getpmsg
 189    i386    putpmsg
index a582bfe..6ffa7f9 100644 (file)
 128    64      rt_sigtimedwait         sys_rt_sigtimedwait
 129    64      rt_sigqueueinfo         sys_rt_sigqueueinfo
 130    common  rt_sigsuspend           sys_rt_sigsuspend
-131    64      sigaltstack             stub_sigaltstack
+131    64      sigaltstack             sys_sigaltstack
 132    common  utime                   sys_utime
 133    common  mknod                   sys_mknod
 134    64      uselib
index 0fd20f2..96b89d8 100644 (file)
@@ -13,6 +13,7 @@ endmenu
 config UML_X86
        def_bool y
        select GENERIC_FIND_FIRST_BIT
+       select GENERIC_SIGALTSTACK
 
 config 64BIT
        bool "64-bit kernel" if SUBARCH = "x86"
index 812e98c..a0c3b0d 100644 (file)
@@ -27,7 +27,6 @@
 #define ptregs_iopl sys_iopl
 #define ptregs_vm86old sys_vm86old
 #define ptregs_vm86 sys_vm86
-#define ptregs_sigaltstack sys_sigaltstack
 
 #define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ;
 #include <asm/syscalls_32.h>
index 170bd92..f2f0723 100644 (file)
@@ -31,7 +31,6 @@
 #define stub_fork sys_fork
 #define stub_vfork sys_vfork
 #define stub_execve sys_execve
-#define stub_sigaltstack sys_sigaltstack
 #define stub_rt_sigreturn sys_rt_sigreturn
 
 #define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat)
index 9fe5f94..6ca1e08 100644 (file)
@@ -63,6 +63,7 @@ struct getcpu_cache;
 struct old_linux_dirent;
 struct perf_event_attr;
 struct file_handle;
+struct sigaltstack;
 
 #include <linux/types.h>
 #include <linux/aio_abi.h>
@@ -299,6 +300,11 @@ asmlinkage long sys_personality(unsigned int personality);
 asmlinkage long sys_sigpending(old_sigset_t __user *set);
 asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
                                old_sigset_t __user *oset);
+#ifdef CONFIG_GENERIC_SIGALTSTACK
+asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
+                               struct sigaltstack __user *uoss);
+#endif
+
 asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
 asmlinkage long sys_setitimer(int which,
                                struct itimerval __user *value,
index 887f2fe..f05f4c4 100644 (file)
@@ -3102,6 +3102,12 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
 out:
        return error;
 }
+#ifdef CONFIG_GENERIC_SIGALTSTACK
+SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss)
+{
+       return do_sigaltstack(uss, uoss, current_user_stack_pointer());
+}
+#endif
 
 int restore_altstack(const stack_t __user *uss)
 {