From bdc40abf070eab82d27de99ef5ff62a1c5de238d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 25 Dec 2012 18:45:43 -0500 Subject: [PATCH] sparc: switch sys_compat_rt_sigaction() to COMPAT_SYSCALL_DEFINE note that while struct compat_sigaction is the generic one, syscall itself *isn't* - different arguments. IOW, CONFIG_ODD_RT_SIGACTION stays. Signed-off-by: Al Viro --- arch/sparc/Kconfig | 1 + arch/sparc/kernel/sys_sparc32.c | 24 +++++++----------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index d190ff8d5310..9d2c395440df 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -46,6 +46,7 @@ config SPARC select GENERIC_COMPAT_RT_SIGQUEUEINFO select GENERIC_COMPAT_RT_SIGPROCMASK select GENERIC_COMPAT_RT_SIGPENDING + select GENERIC_COMPAT_RT_SIGACTION config SPARC32 def_bool !64BIT diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c index feb016316f90..4e96771a1b59 100644 --- a/arch/sparc/kernel/sys_sparc32.c +++ b/arch/sparc/kernel/sys_sparc32.c @@ -248,11 +248,11 @@ asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act return ret; } -asmlinkage long compat_sys_rt_sigaction(int sig, - struct sigaction32 __user *act, - struct sigaction32 __user *oact, - void __user *restorer, - compat_size_t sigsetsize) +COMPAT_SYSCALL_DEFINE5(rt_sigaction, int, sig, + struct compat_sigaction __user *,act, + struct compat_sigaction __user *,oact, + void __user *,restorer, + compat_size_t,sigsetsize) { struct k_sigaction new_ka, old_ka; int ret; @@ -269,12 +269,7 @@ asmlinkage long compat_sys_rt_sigaction(int sig, ret = get_user(u_handler, &act->sa_handler); new_ka.sa.sa_handler = compat_ptr(u_handler); ret |= __copy_from_user(&set32, &act->sa_mask, sizeof(compat_sigset_t)); - switch (_NSIG_WORDS) { - case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6] | (((long)set32.sig[7]) << 32); - case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4] | (((long)set32.sig[5]) << 32); - case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2] | (((long)set32.sig[3]) << 32); - case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0] | (((long)set32.sig[1]) << 32); - } + sigset_from_compat(&new_ka.sa.sa_mask, &set32); ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); ret |= __get_user(u_restorer, &act->sa_restorer); new_ka.sa.sa_restorer = compat_ptr(u_restorer); @@ -285,12 +280,7 @@ asmlinkage long compat_sys_rt_sigaction(int sig, ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); if (!ret && oact) { - switch (_NSIG_WORDS) { - case 4: set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32); set32.sig[6] = old_ka.sa.sa_mask.sig[3]; - case 3: set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32); set32.sig[4] = old_ka.sa.sa_mask.sig[2]; - case 2: set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32); set32.sig[2] = old_ka.sa.sa_mask.sig[1]; - case 1: set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); set32.sig[0] = old_ka.sa.sa_mask.sig[0]; - } + sigset_to_compat(&set32, &old_ka.sa.sa_mask); ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), &oact->sa_handler); ret |= __copy_to_user(&oact->sa_mask, &set32, sizeof(compat_sigset_t)); ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); -- 2.34.1