sigpending(): move compat to native
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 31 May 2017 08:42:07 +0000 (04:42 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 10 Jun 2017 03:51:38 +0000 (23:51 -0400)
... and kill set_fs() use

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
kernel/compat.c
kernel/signal.c

index 58b8e57398d1ddfeb5bd9b7028309103adad2b91..195e23469854eea52ecb2610e237bb78ab89889f 100644 (file)
@@ -350,29 +350,6 @@ COMPAT_SYSCALL_DEFINE3(setitimer, int, which,
        return 0;
 }
 
-#ifdef __ARCH_WANT_SYS_SIGPENDING
-
-/*
- * Assumption: old_sigset_t and compat_old_sigset_t are both
- * types that can be passed to put_user()/get_user().
- */
-
-COMPAT_SYSCALL_DEFINE1(sigpending, compat_old_sigset_t __user *, set)
-{
-       old_sigset_t s;
-       long ret;
-       mm_segment_t old_fs = get_fs();
-
-       set_fs(KERNEL_DS);
-       ret = sys_sigpending((old_sigset_t __user *) &s);
-       set_fs(old_fs);
-       if (ret == 0)
-               ret = put_user(s, set);
-       return ret;
-}
-
-#endif
-
 #ifdef __ARCH_WANT_SYS_SIGPROCMASK
 
 /*
index d1eed0d7ca6499d82f51afbbb77b94be830b73cb..6237f492adfca6f07fb1f075bbf957ba61bda26d 100644 (file)
@@ -3254,6 +3254,18 @@ SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
        return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t)); 
 }
 
+#ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE1(sigpending, compat_old_sigset_t __user *, set32)
+{
+       sigset_t set;
+       int err = do_sigpending(&set, sizeof(old_sigset_t)); 
+       if (err == 0)
+               if (copy_to_user(set32, &set, sizeof(old_sigset_t)))
+                       err = -EFAULT;
+       return err;
+}
+#endif
+
 #endif
 
 #ifdef __ARCH_WANT_SYS_SIGPROCMASK