]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
y2038: signal: Add compat_sys_rt_sigtimedwait_time64
authorArnd Bergmann <arnd@arndb.de>
Wed, 18 Apr 2018 14:18:35 +0000 (16:18 +0200)
committerArnd Bergmann <arnd@arndb.de>
Tue, 18 Dec 2018 15:13:04 +0000 (16:13 +0100)
Now that 32-bit architectures have two variants of sys_rt_sigtimedwaid()
for 32-bit and 64-bit time_t, we also need to have a second compat system
call entry point on the corresponding 64-bit architectures.

The traditional system call keeps getting handled
by compat_sys_rt_sigtimedwait(), and this adds a new
compat_sys_rt_sigtimedwait_time64() that differs only in the timeout
argument type.

The naming remains a bit asymmetric for the moment. Ideally we would
want to have compat_sys_rt_sigtimedwait_time32() for the old version
and compat_sys_rt_sigtimedwait() for the new one to mirror the names
of the native entry points, but renaming the existing system call
tables causes unnecessary churn. I would suggest renaming all such
system calls together at a later point.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
include/linux/compat.h
kernel/signal.c

index 4b0463608589e07bb8b30d2bb3e9d54e502f28fd..056be0d037225865618b077a163d65c20c08ed0a 100644 (file)
@@ -788,6 +788,9 @@ asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
 asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
                struct compat_siginfo __user *uinfo,
                struct old_timespec32 __user *uts, compat_size_t sigsetsize);
+asmlinkage long compat_sys_rt_sigtimedwait_time64(compat_sigset_t __user *uthese,
+               struct compat_siginfo __user *uinfo,
+               struct __kernel_timespec __user *uts, compat_size_t sigsetsize);
 asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
                                struct compat_siginfo __user *uinfo);
 /* No generic prototype for rt_sigreturn */
index be6744cd0a11b7d464600eec04095a0698d8e63a..53e07d97ffe018f391fa7976573dc0e0c93c40cb 100644 (file)
@@ -3366,6 +3366,37 @@ SYSCALL_DEFINE4(rt_sigtimedwait_time32, const sigset_t __user *, uthese,
 #endif
 
 #ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait_time64, compat_sigset_t __user *, uthese,
+               struct compat_siginfo __user *, uinfo,
+               struct __kernel_timespec __user *, uts, compat_size_t, sigsetsize)
+{
+       sigset_t s;
+       struct timespec64 t;
+       kernel_siginfo_t info;
+       long ret;
+
+       if (sigsetsize != sizeof(sigset_t))
+               return -EINVAL;
+
+       if (get_compat_sigset(&s, uthese))
+               return -EFAULT;
+
+       if (uts) {
+               if (get_timespec64(&t, uts))
+                       return -EFAULT;
+       }
+
+       ret = do_sigtimedwait(&s, &info, uts ? &t : NULL);
+
+       if (ret > 0 && uinfo) {
+               if (copy_siginfo_to_user32(uinfo, &info))
+                       ret = -EFAULT;
+       }
+
+       return ret;
+}
+
+#ifdef CONFIG_COMPAT_32BIT_TIME
 COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
                struct compat_siginfo __user *, uinfo,
                struct old_timespec32 __user *, uts, compat_size_t, sigsetsize)
@@ -3396,6 +3427,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
        return ret;
 }
 #endif
+#endif
 
 /**
  *  sys_kill - send a signal to a process