diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-25 13:32:58 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-03 15:09:19 -0500 |
commit | 322a56cb1fcbe228eee5cdb8a9c6df9f797d998c (patch) | |
tree | feedbad82fdfacf9f4d5ddd343905f6057a71fee /kernel/signal.c | |
parent | ad4b65a434bdd2ff37d095ab1ccd836203e985ba (diff) |
generic compat_sys_rt_sigprocmask()
conditional on GENERIC_COMPAT_RT_SIGPROCMASK; by the end of that series
it will become the same thing as COMPAT and conditional will die out.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 4a0934e03d5c..bce1222b7315 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -2613,6 +2613,47 @@ SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, nset, | |||
2613 | return 0; | 2613 | return 0; |
2614 | } | 2614 | } |
2615 | 2615 | ||
2616 | #ifdef CONFIG_COMPAT | ||
2617 | #ifdef CONFIG_GENERIC_COMPAT_RT_SIGPROCMASK | ||
2618 | COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset, | ||
2619 | compat_sigset_t __user *, oset, compat_size_t, sigsetsize) | ||
2620 | { | ||
2621 | #ifdef __BIG_ENDIAN | ||
2622 | sigset_t old_set = current->blocked; | ||
2623 | |||
2624 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
2625 | if (sigsetsize != sizeof(sigset_t)) | ||
2626 | return -EINVAL; | ||
2627 | |||
2628 | if (nset) { | ||
2629 | compat_sigset_t new32; | ||
2630 | sigset_t new_set; | ||
2631 | int error; | ||
2632 | if (copy_from_user(&new32, nset, sizeof(compat_sigset_t))) | ||
2633 | return -EFAULT; | ||
2634 | |||
2635 | sigset_from_compat(&new_set, &new32); | ||
2636 | sigdelsetmask(&new_set, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
2637 | |||
2638 | error = sigprocmask(how, &new_set, NULL); | ||
2639 | if (error) | ||
2640 | return error; | ||
2641 | } | ||
2642 | if (oset) { | ||
2643 | compat_sigset_t old32; | ||
2644 | sigset_to_compat(&old32, &old_set); | ||
2645 | if (copy_to_user(oset, &old_set, sizeof(sigset_t))) | ||
2646 | return -EFAULT; | ||
2647 | } | ||
2648 | return 0; | ||
2649 | #else | ||
2650 | return sys_rt_sigprocmask(how, (sigset_t __user *)nset, | ||
2651 | (sigset_t __user *)oset, sigsetsize); | ||
2652 | #endif | ||
2653 | } | ||
2654 | #endif | ||
2655 | #endif | ||
2656 | |||
2616 | long do_sigpending(void __user *set, unsigned long sigsetsize) | 2657 | long do_sigpending(void __user *set, unsigned long sigsetsize) |
2617 | { | 2658 | { |
2618 | long error = -EINVAL; | 2659 | long error = -EINVAL; |