Skip to content

Commit 49c39f8

Browse files
committed
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 <[email protected]>
1 parent c2e6c85 commit 49c39f8

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

include/linux/syscalls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set,
635635
asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize);
636636
asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese,
637637
siginfo_t __user *uinfo,
638-
const struct timespec __user *uts,
638+
const struct __kernel_timespec __user *uts,
639639
size_t sigsetsize);
640640
asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo);
641641

kernel/signal.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3082,17 +3082,17 @@ int copy_siginfo_from_user32(struct siginfo *to,
30823082
* @ts: upper bound on process time suspension
30833083
*/
30843084
static int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
3085-
const struct timespec *ts)
3085+
const struct timespec64 *ts)
30863086
{
30873087
ktime_t *to = NULL, timeout = KTIME_MAX;
30883088
struct task_struct *tsk = current;
30893089
sigset_t mask = *which;
30903090
int sig, ret = 0;
30913091

30923092
if (ts) {
3093-
if (!timespec_valid(ts))
3093+
if (!timespec64_valid(ts))
30943094
return -EINVAL;
3095-
timeout = timespec_to_ktime(*ts);
3095+
timeout = timespec64_to_ktime(*ts);
30963096
to = &timeout;
30973097
}
30983098

@@ -3140,11 +3140,12 @@ static int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
31403140
* @sigsetsize: size of sigset_t type
31413141
*/
31423142
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,
31443145
size_t, sigsetsize)
31453146
{
31463147
sigset_t these;
3147-
struct timespec ts;
3148+
struct timespec64 ts;
31483149
siginfo_t info;
31493150
int ret;
31503151

@@ -3156,7 +3157,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
31563157
return -EFAULT;
31573158

31583159
if (uts) {
3159-
if (copy_from_user(&ts, uts, sizeof(ts)))
3160+
if (get_timespec64(&ts, uts))
31603161
return -EFAULT;
31613162
}
31623163

@@ -3176,7 +3177,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
31763177
struct old_timespec32 __user *, uts, compat_size_t, sigsetsize)
31773178
{
31783179
sigset_t s;
3179-
struct timespec t;
3180+
struct timespec64 t;
31803181
siginfo_t info;
31813182
long ret;
31823183

@@ -3187,7 +3188,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
31873188
return -EFAULT;
31883189

31893190
if (uts) {
3190-
if (compat_get_timespec(&t, uts))
3191+
if (get_old_timespec32(&t, uts))
31913192
return -EFAULT;
31923193
}
31933194

0 commit comments

Comments
 (0)