diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-23 03:41:17 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-03 18:16:17 -0500 |
commit | 99b06feb0f7c99f171cb962d0e6a17f81625abd3 (patch) | |
tree | e2d184a61dcf5b0317bfbc204c1e9e4256649b7f /arch/sparc/kernel/signal32.c | |
parent | 0aa0203fb43f04714004b2c4ad33b858e240555d (diff) |
sparc: switch to generic sigaltstack
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/sparc/kernel/signal32.c')
-rw-r--r-- | arch/sparc/kernel/signal32.c | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index 53e48f721ce3..9d9eb91d0de1 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -61,7 +61,7 @@ struct rt_signal_frame32 { | |||
61 | compat_sigset_t mask; | 61 | compat_sigset_t mask; |
62 | /* __siginfo_fpu_t * */ u32 fpu_save; | 62 | /* __siginfo_fpu_t * */ u32 fpu_save; |
63 | unsigned int insns[2]; | 63 | unsigned int insns[2]; |
64 | stack_t32 stack; | 64 | compat_stack_t stack; |
65 | unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */ | 65 | unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */ |
66 | /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */ | 66 | /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */ |
67 | siginfo_extra_v8plus_t v8plus; | 67 | siginfo_extra_v8plus_t v8plus; |
@@ -230,13 +230,11 @@ segv: | |||
230 | asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) | 230 | asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) |
231 | { | 231 | { |
232 | struct rt_signal_frame32 __user *sf; | 232 | struct rt_signal_frame32 __user *sf; |
233 | unsigned int psr, pc, npc, u_ss_sp; | 233 | unsigned int psr, pc, npc; |
234 | compat_uptr_t fpu_save; | 234 | compat_uptr_t fpu_save; |
235 | compat_uptr_t rwin_save; | 235 | compat_uptr_t rwin_save; |
236 | mm_segment_t old_fs; | ||
237 | sigset_t set; | 236 | sigset_t set; |
238 | compat_sigset_t seta; | 237 | compat_sigset_t seta; |
239 | stack_t st; | ||
240 | int err, i; | 238 | int err, i; |
241 | 239 | ||
242 | /* Always make any pending restarted system calls return -EINTR */ | 240 | /* Always make any pending restarted system calls return -EINTR */ |
@@ -295,20 +293,10 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) | |||
295 | if (!err && fpu_save) | 293 | if (!err && fpu_save) |
296 | err |= restore_fpu_state(regs, compat_ptr(fpu_save)); | 294 | err |= restore_fpu_state(regs, compat_ptr(fpu_save)); |
297 | err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t)); | 295 | err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t)); |
298 | err |= __get_user(u_ss_sp, &sf->stack.ss_sp); | 296 | err |= compat_restore_altstack(&sf->stack); |
299 | st.ss_sp = compat_ptr(u_ss_sp); | ||
300 | err |= __get_user(st.ss_flags, &sf->stack.ss_flags); | ||
301 | err |= __get_user(st.ss_size, &sf->stack.ss_size); | ||
302 | if (err) | 297 | if (err) |
303 | goto segv; | 298 | goto segv; |
304 | 299 | ||
305 | /* It is more difficult to avoid calling this function than to | ||
306 | call it and ignore errors. */ | ||
307 | old_fs = get_fs(); | ||
308 | set_fs(KERNEL_DS); | ||
309 | do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf); | ||
310 | set_fs(old_fs); | ||
311 | |||
312 | err |= __get_user(rwin_save, &sf->rwin_save); | 300 | err |= __get_user(rwin_save, &sf->rwin_save); |
313 | if (!err && rwin_save) { | 301 | if (!err && rwin_save) { |
314 | if (restore_rwin_state(compat_ptr(rwin_save))) | 302 | if (restore_rwin_state(compat_ptr(rwin_save))) |
@@ -642,9 +630,7 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs, | |||
642 | err |= copy_siginfo_to_user32(&sf->info, info); | 630 | err |= copy_siginfo_to_user32(&sf->info, info); |
643 | 631 | ||
644 | /* Setup sigaltstack */ | 632 | /* Setup sigaltstack */ |
645 | err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); | 633 | err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]); |
646 | err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags); | ||
647 | err |= __put_user(current->sas_ss_size, &sf->stack.ss_size); | ||
648 | 634 | ||
649 | switch (_NSIG_WORDS) { | 635 | switch (_NSIG_WORDS) { |
650 | case 4: seta.sig[7] = (oldset->sig[3] >> 32); | 636 | case 4: seta.sig[7] = (oldset->sig[3] >> 32); |
@@ -856,29 +842,3 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp) | |||
856 | out: | 842 | out: |
857 | return ret; | 843 | return ret; |
858 | } | 844 | } |
859 | |||
860 | asmlinkage long do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp) | ||
861 | { | ||
862 | stack_t uss, uoss; | ||
863 | u32 u_ss_sp = 0; | ||
864 | int ret; | ||
865 | mm_segment_t old_fs; | ||
866 | stack_t32 __user *uss32 = compat_ptr(ussa); | ||
867 | stack_t32 __user *uoss32 = compat_ptr(uossa); | ||
868 | |||
869 | if (ussa && (get_user(u_ss_sp, &uss32->ss_sp) || | ||
870 | __get_user(uss.ss_flags, &uss32->ss_flags) || | ||
871 | __get_user(uss.ss_size, &uss32->ss_size))) | ||
872 | return -EFAULT; | ||
873 | uss.ss_sp = compat_ptr(u_ss_sp); | ||
874 | old_fs = get_fs(); | ||
875 | set_fs(KERNEL_DS); | ||
876 | ret = do_sigaltstack(ussa ? (stack_t __user *) &uss : NULL, | ||
877 | uossa ? (stack_t __user *) &uoss : NULL, sp); | ||
878 | set_fs(old_fs); | ||
879 | if (!ret && uossa && (put_user(ptr_to_compat(uoss.ss_sp), &uoss32->ss_sp) || | ||
880 | __put_user(uoss.ss_flags, &uoss32->ss_flags) || | ||
881 | __put_user(uoss.ss_size, &uoss32->ss_size))) | ||
882 | return -EFAULT; | ||
883 | return ret; | ||
884 | } | ||