Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

y2038: signal: Change rt_sigtimedwait to use __kernel_timespec

This changes sys_rt_sigtimedwait() to use get_timespec64(), changing
the timeout type to __kernel_timespec, which will be changed to use
a 64-bit time_t in the future. Since the do_sigtimedwait() core
function changes, we also have to modify the compat version of this
system call in the same way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+10 -9
+1 -1
include/linux/syscalls.h
··· 635 635 asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize); 636 636 asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese, 637 637 siginfo_t __user *uinfo, 638 - const struct timespec __user *uts, 638 + const struct __kernel_timespec __user *uts, 639 639 size_t sigsetsize); 640 640 asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo); 641 641
+9 -8
kernel/signal.c
··· 3082 3082 * @ts: upper bound on process time suspension 3083 3083 */ 3084 3084 static int do_sigtimedwait(const sigset_t *which, siginfo_t *info, 3085 - const struct timespec *ts) 3085 + const struct timespec64 *ts) 3086 3086 { 3087 3087 ktime_t *to = NULL, timeout = KTIME_MAX; 3088 3088 struct task_struct *tsk = current; ··· 3090 3090 int sig, ret = 0; 3091 3091 3092 3092 if (ts) { 3093 - if (!timespec_valid(ts)) 3093 + if (!timespec64_valid(ts)) 3094 3094 return -EINVAL; 3095 - timeout = timespec_to_ktime(*ts); 3095 + timeout = timespec64_to_ktime(*ts); 3096 3096 to = &timeout; 3097 3097 } 3098 3098 ··· 3140 3140 * @sigsetsize: size of sigset_t type 3141 3141 */ 3142 3142 SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, 3143 - siginfo_t __user *, uinfo, const struct timespec __user *, uts, 3143 + siginfo_t __user *, uinfo, 3144 + const struct __kernel_timespec __user *, uts, 3144 3145 size_t, sigsetsize) 3145 3146 { 3146 3147 sigset_t these; 3147 - struct timespec ts; 3148 + struct timespec64 ts; 3148 3149 siginfo_t info; 3149 3150 int ret; 3150 3151 ··· 3157 3156 return -EFAULT; 3158 3157 3159 3158 if (uts) { 3160 - if (copy_from_user(&ts, uts, sizeof(ts))) 3159 + if (get_timespec64(&ts, uts)) 3161 3160 return -EFAULT; 3162 3161 } 3163 3162 ··· 3177 3176 struct old_timespec32 __user *, uts, compat_size_t, sigsetsize) 3178 3177 { 3179 3178 sigset_t s; 3180 - struct timespec t; 3179 + struct timespec64 t; 3181 3180 siginfo_t info; 3182 3181 long ret; 3183 3182 ··· 3188 3187 return -EFAULT; 3189 3188 3190 3189 if (uts) { 3191 - if (compat_get_timespec(&t, uts)) 3190 + if (get_old_timespec32(&t, uts)) 3192 3191 return -EFAULT; 3193 3192 } 3194 3193