powerpc: switch to generic old sigaction()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 26 Dec 2012 00:27:42 +0000 (19:27 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 3 Feb 2013 23:16:10 +0000 (18:16 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/powerpc/Kconfig
arch/powerpc/include/uapi/asm/signal.h
arch/powerpc/kernel/ppc32.h
arch/powerpc/kernel/signal_32.c

index bec7808..ec89a7b 100644 (file)
@@ -150,6 +150,7 @@ config PPC
        select GENERIC_COMPAT_RT_SIGPROCMASK
        select GENERIC_COMPAT_RT_SIGPENDING
        select OLD_SIGSUSPEND
+       select OLD_SIGACTION if PPC32
 
 config EARLY_PRINTK
        bool
@@ -160,6 +161,7 @@ config COMPAT
        default y if PPC64
        select COMPAT_BINFMT_ELF
        select ARCH_WANT_OLD_COMPAT_IPC
+       select COMPAT_OLD_SIGACTION
 
 config SYSVIPC_COMPAT
        bool
index 6defdd6..6c69ee9 100644 (file)
@@ -90,6 +90,7 @@ typedef struct {
 
 #include <asm-generic/signal-defs.h>
 
+#ifndef __KERNEL__
 struct old_sigaction {
        __sighandler_t sa_handler;
        old_sigset_t sa_mask;
@@ -97,7 +98,6 @@ struct old_sigaction {
        __sigrestore_t sa_restorer;
 };
 
-#ifndef __KERNEL__
 struct sigaction {
        __sighandler_t sa_handler;
        unsigned long sa_flags;
index fe92b0d..a27c914 100644 (file)
 
 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
 
-#define __old_sigaction32      old_sigaction32
-
-struct __old_sigaction32 {
-       compat_uptr_t           sa_handler;
-       compat_old_sigset_t     sa_mask;
-       unsigned int            sa_flags;
-       compat_uptr_t           sa_restorer;     /* not used by Linux/SPARC yet */
-};
-
 struct pt_regs32 {
        unsigned int gpr[32];
        unsigned int nip;
index 16ec1c9..802ab5e 100644 (file)
@@ -57,7 +57,6 @@
 
 #ifdef CONFIG_PPC64
 #define sys_rt_sigreturn       compat_sys_rt_sigreturn
-#define sys_sigaction  compat_sys_sigaction
 #define sys_swapcontext        compat_sys_swapcontext
 #define sys_sigreturn  compat_sys_sigreturn
 
@@ -130,23 +129,6 @@ static inline int get_sigset_t(sigset_t *set,
        return 0;
 }
 
-static inline int get_old_sigaction(struct k_sigaction *new_ka,
-               struct old_sigaction __user *act)
-{
-       compat_old_sigset_t mask;
-       compat_uptr_t handler, restorer;
-
-       if (get_user(handler, &act->sa_handler) ||
-           __get_user(restorer, &act->sa_restorer) ||
-           __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
-           __get_user(mask, &act->sa_mask))
-               return -EFAULT;
-       new_ka->sa.sa_handler = compat_ptr(handler);
-       new_ka->sa.sa_restorer = compat_ptr(restorer);
-       siginitset(&new_ka->sa.sa_mask, mask);
-       return 0;
-}
-
 #define to_user_ptr(p)         ptr_to_compat(p)
 #define from_user_ptr(p)       compat_ptr(p)
 
@@ -196,21 +178,6 @@ static inline int get_sigset_t(sigset_t *set, const sigset_t __user *uset)
        return copy_from_user(set, uset, sizeof(*uset));
 }
 
-static inline int get_old_sigaction(struct k_sigaction *new_ka,
-               struct old_sigaction __user *act)
-{
-       old_sigset_t mask;
-
-       if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
-                       __get_user(new_ka->sa.sa_handler, &act->sa_handler) ||
-                       __get_user(new_ka->sa.sa_restorer, &act->sa_restorer) ||
-                       __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
-                       __get_user(mask, &act->sa_mask))
-               return -EFAULT;
-       siginitset(&new_ka->sa.sa_mask, mask);
-       return 0;
-}
-
 #define to_user_ptr(p)         ((unsigned long)(p))
 #define from_user_ptr(p)       ((void __user *)(p))
 
@@ -234,40 +201,8 @@ static inline int restore_general_regs(struct pt_regs *regs,
                return -EFAULT;
        return 0;
 }
-
-#endif /* CONFIG_PPC64 */
-
-long sys_sigaction(int sig, struct old_sigaction __user *act,
-               struct old_sigaction __user *oact)
-{
-       struct k_sigaction new_ka, old_ka;
-       int ret;
-
-#ifdef CONFIG_PPC64
-       if (sig < 0)
-               sig = -sig;
 #endif
 
-       if (act) {
-               if (get_old_sigaction(&new_ka, act))
-                       return -EFAULT;
-       }
-
-       ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-       if (!ret && oact) {
-               if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
-                   __put_user(to_user_ptr(old_ka.sa.sa_handler),
-                           &oact->sa_handler) ||
-                   __put_user(to_user_ptr(old_ka.sa.sa_restorer),
-                           &oact->sa_restorer) ||
-                   __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
-                   __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
-                       return -EFAULT;
-       }
-
-       return ret;
-}
-
 /*
  * When we have signals to deliver, we set up on the
  * user stack, going down from the original stack pointer: