Skip to content

Commit 1b3c872

Browse files
author
Al Viro
committed
rt_sigtimedwait(): move compat to native
Signed-off-by: Al Viro <[email protected]>
1 parent 464d624 commit 1b3c872

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

include/linux/signal.h

-2
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ extern int do_send_sig_info(int sig, struct siginfo *info,
246246
struct task_struct *p, bool group);
247247
extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
248248
extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
249-
extern int do_sigtimedwait(const sigset_t *, siginfo_t *,
250-
const struct timespec *);
251249
extern int sigprocmask(int, sigset_t *, sigset_t *);
252250
extern void set_current_blocked(sigset_t *);
253251
extern void __set_current_blocked(const sigset_t *);

kernel/compat.c

-32
Original file line numberDiff line numberDiff line change
@@ -866,38 +866,6 @@ sigset_to_compat(compat_sigset_t *compat, const sigset_t *set)
866866
}
867867
}
868868

869-
COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
870-
struct compat_siginfo __user *, uinfo,
871-
struct compat_timespec __user *, uts, compat_size_t, sigsetsize)
872-
{
873-
compat_sigset_t s32;
874-
sigset_t s;
875-
struct timespec t;
876-
siginfo_t info;
877-
long ret;
878-
879-
if (sigsetsize != sizeof(sigset_t))
880-
return -EINVAL;
881-
882-
if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t)))
883-
return -EFAULT;
884-
sigset_from_compat(&s, &s32);
885-
886-
if (uts) {
887-
if (compat_get_timespec(&t, uts))
888-
return -EFAULT;
889-
}
890-
891-
ret = do_sigtimedwait(&s, &info, uts ? &t : NULL);
892-
893-
if (ret > 0 && uinfo) {
894-
if (copy_siginfo_to_user32(uinfo, &info))
895-
ret = -EFAULT;
896-
}
897-
898-
return ret;
899-
}
900-
901869
#ifdef __ARCH_WANT_COMPAT_SYS_TIME
902870

903871
/* compat_time_t is a 32 bit "long" and needs to get converted. */

kernel/signal.c

+35-1
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,7 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
27682768
* @info: if non-null, the signal's siginfo is returned here
27692769
* @ts: upper bound on process time suspension
27702770
*/
2771-
int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
2771+
static int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
27722772
const struct timespec *ts)
27732773
{
27742774
ktime_t *to = NULL, timeout = KTIME_MAX;
@@ -2857,6 +2857,40 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
28572857
return ret;
28582858
}
28592859

2860+
#ifdef CONFIG_COMPAT
2861+
COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
2862+
struct compat_siginfo __user *, uinfo,
2863+
struct compat_timespec __user *, uts, compat_size_t, sigsetsize)
2864+
{
2865+
compat_sigset_t s32;
2866+
sigset_t s;
2867+
struct timespec t;
2868+
siginfo_t info;
2869+
long ret;
2870+
2871+
if (sigsetsize != sizeof(sigset_t))
2872+
return -EINVAL;
2873+
2874+
if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t)))
2875+
return -EFAULT;
2876+
sigset_from_compat(&s, &s32);
2877+
2878+
if (uts) {
2879+
if (compat_get_timespec(&t, uts))
2880+
return -EFAULT;
2881+
}
2882+
2883+
ret = do_sigtimedwait(&s, &info, uts ? &t : NULL);
2884+
2885+
if (ret > 0 && uinfo) {
2886+
if (copy_siginfo_to_user32(uinfo, &info))
2887+
ret = -EFAULT;
2888+
}
2889+
2890+
return ret;
2891+
}
2892+
#endif
2893+
28602894
/**
28612895
* sys_kill - send a signal to a process
28622896
* @pid: the PID of the process

0 commit comments

Comments
 (0)