aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-12-25 18:38:15 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-03 15:09:23 -0500
commit08d32fe504a7670cab3190c624448695adcf70e4 (patch)
treea6fcff4e53049064fe4d9e060e2bb41ae842fb42 /kernel
parent574c4866e33d648520a8bd5bf6f573ea6e554e88 (diff)
generic sys_compat_rt_sigaction()
Again, protected by a temporary config symbol (GENERIC_COMPAT_RT_SIGACTION); will be gone by the end of series. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/signal.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 5a4aed1244fb..f3665f3de660 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3358,6 +3358,55 @@ SYSCALL_DEFINE4(rt_sigaction, int, sig,
3358out: 3358out:
3359 return ret; 3359 return ret;
3360} 3360}
3361#ifdef CONFIG_COMPAT
3362#ifdef CONFIG_GENERIC_COMPAT_RT_SIGACTION
3363COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
3364 const struct compat_sigaction __user *, act,
3365 struct compat_sigaction __user *, oact,
3366 compat_size_t, sigsetsize)
3367{
3368 struct k_sigaction new_ka, old_ka;
3369 compat_sigset_t mask;
3370#ifdef __ARCH_HAS_SA_RESTORER
3371 compat_uptr_t restorer;
3372#endif
3373 int ret;
3374
3375 /* XXX: Don't preclude handling different sized sigset_t's. */
3376 if (sigsetsize != sizeof(compat_sigset_t))
3377 return -EINVAL;
3378
3379 if (act) {
3380 compat_uptr_t handler;
3381 ret = get_user(handler, &act->sa_handler);
3382 new_ka.sa.sa_handler = compat_ptr(handler);
3383#ifdef __ARCH_HAS_SA_RESTORER
3384 ret |= get_user(restorer, &act->sa_restorer);
3385 new_ka.sa.sa_restorer = compat_ptr(restorer);
3386#endif
3387 ret |= copy_from_user(&mask, &act->sa_mask, sizeof(mask));
3388 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
3389 if (ret)
3390 return -EFAULT;
3391 sigset_from_compat(&new_ka.sa.sa_mask, &mask);
3392 }
3393
3394 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
3395 if (!ret && oact) {
3396 sigset_to_compat(&mask, &old_ka.sa.sa_mask);
3397 ret = put_user(ptr_to_compat(old_ka.sa.sa_handler),
3398 &oact->sa_handler);
3399 ret |= copy_to_user(&oact->sa_mask, &mask, sizeof(mask));
3400 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
3401#ifdef __ARCH_HAS_SA_RESTORER
3402 ret |= put_user(ptr_to_compat(old_ka.sa.sa_restorer),
3403 &oact->sa_restorer);
3404#endif
3405 }
3406 return ret;
3407}
3408#endif
3409#endif
3361#endif /* !CONFIG_ODD_RT_SIGACTION */ 3410#endif /* !CONFIG_ODD_RT_SIGACTION */
3362 3411
3363#ifdef __ARCH_WANT_SYS_SGETMASK 3412#ifdef __ARCH_WANT_SYS_SGETMASK