Skip to content

Commit ad4b65a

Browse files
author
Al Viro
committed
consolidate rt_sigsuspend()
* pull compat version alongside with the native one * make little-endian compat variant just call the native * don't bother with separate conditional for compat (both native and compat are going to become unconditional very soon). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent eaca6ea commit ad4b65a

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

‎kernel/compat.c‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,23 +1067,6 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr)
10671067

10681068
#endif /* __ARCH_WANT_COMPAT_SYS_TIME */
10691069

1070-
#ifdef __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
1071-
asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat_size_t sigsetsize)
1072-
{
1073-
sigset_t newset;
1074-
compat_sigset_t newset32;
1075-
1076-
/* XXX: Don't preclude handling different sized sigset_t's. */
1077-
if (sigsetsize != sizeof(sigset_t))
1078-
return -EINVAL;
1079-
1080-
if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t)))
1081-
return -EFAULT;
1082-
sigset_from_compat(&newset, &newset32);
1083-
return sigsuspend(&newset);
1084-
}
1085-
#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */
1086-
10871070
asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
10881071
{
10891072
struct timex txc;

‎kernel/signal.c‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3352,7 +3352,29 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
33523352
return -EFAULT;
33533353
return sigsuspend(&newset);
33543354
}
3355-
#endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */
3355+
3356+
#ifdef CONFIG_COMPAT
3357+
COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_size_t, sigsetsize)
3358+
{
3359+
#ifdef __BIG_ENDIAN
3360+
sigset_t newset;
3361+
compat_sigset_t newset32;
3362+
3363+
/* XXX: Don't preclude handling different sized sigset_t's. */
3364+
if (sigsetsize != sizeof(sigset_t))
3365+
return -EINVAL;
3366+
3367+
if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t)))
3368+
return -EFAULT;
3369+
sigset_from_compat(&newset, &newset32);
3370+
return sigsuspend(&newset);
3371+
#else
3372+
/* on little-endian bitmaps don't care about granularity */
3373+
return sys_rt_sigsuspend((sigset_t __user *)unewset, sigsetsize);
3374+
#endif
3375+
}
3376+
#endif
3377+
#endif
33563378

33573379
__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma)
33583380
{

0 commit comments

Comments
 (0)