]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
kernel: open-code sys_rt_sigpending() in sys_sigpending()
authorDominik Brodowski <linux@dominikbrodowski.net>
Sun, 11 Mar 2018 10:34:37 +0000 (11:34 +0100)
committerDominik Brodowski <linux@dominikbrodowski.net>
Mon, 2 Apr 2018 18:15:00 +0000 (20:15 +0200)
A similar but not fully equivalent code path is already open-coded
three times (in sys_rt_sigpending and in the two compat stubs), so
do it a fourth time here.

This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
include/linux/syscalls.h
kernel/signal.c

index 0526286a0314a3e23be635f3b21263c3f7bc7bc8..a63e21e7a3afa5f3cd8264598948513e8a1fafec 100644 (file)
@@ -288,7 +288,7 @@ asmlinkage long sys_capset(cap_user_header_t header,
                                const cap_user_data_t data);
 asmlinkage long sys_personality(unsigned int personality);
 
-asmlinkage long sys_sigpending(old_sigset_t __user *set);
+asmlinkage long sys_sigpending(old_sigset_t __user *uset);
 asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
                                old_sigset_t __user *oset);
 asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
index c6e4c83dc090ab1361ee9c229f8ff185295c2f46..985c61749bcf2cad41d0d9a7f10773e32f0d8ebb 100644 (file)
@@ -3629,11 +3629,20 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
 
 /**
  *  sys_sigpending - examine pending signals
- *  @set: where mask of pending signal is returned
+ *  @uset: where mask of pending signal is returned
  */
-SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
+SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, uset)
 {
-       return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t)); 
+       sigset_t set;
+       int err;
+
+       if (sizeof(old_sigset_t) > sizeof(*uset))
+               return -EINVAL;
+
+       err = do_sigpending(&set);
+       if (!err && copy_to_user(uset, &set, sizeof(old_sigset_t)))
+               err = -EFAULT;
+       return err;
 }
 
 #ifdef CONFIG_COMPAT