aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/signal32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/signal32.c')
-rw-r--r--arch/sparc/kernel/signal32.c56
1 files changed, 18 insertions, 38 deletions
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ee789d2ef05d..62deba7be1a9 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -31,6 +31,7 @@
31#include <asm/switch_to.h> 31#include <asm/switch_to.h>
32 32
33#include "sigutil.h" 33#include "sigutil.h"
34#include "kernel.h"
34 35
35/* This magic should be in g_upper[0] for all upper parts 36/* This magic should be in g_upper[0] for all upper parts
36 * to be valid. 37 * to be valid.
@@ -145,7 +146,7 @@ void do_sigreturn32(struct pt_regs *regs)
145 unsigned int psr; 146 unsigned int psr;
146 unsigned pc, npc; 147 unsigned pc, npc;
147 sigset_t set; 148 sigset_t set;
148 unsigned seta[_COMPAT_NSIG_WORDS]; 149 compat_sigset_t seta;
149 int err, i; 150 int err, i;
150 151
151 /* Always make any pending restarted system calls return -EINTR */ 152 /* Always make any pending restarted system calls return -EINTR */
@@ -209,17 +210,13 @@ void do_sigreturn32(struct pt_regs *regs)
209 if (restore_rwin_state(compat_ptr(rwin_save))) 210 if (restore_rwin_state(compat_ptr(rwin_save)))
210 goto segv; 211 goto segv;
211 } 212 }
212 err |= __get_user(seta[0], &sf->info.si_mask); 213 err |= __get_user(seta.sig[0], &sf->info.si_mask);
213 err |= copy_from_user(seta+1, &sf->extramask, 214 err |= copy_from_user(&seta.sig[1], &sf->extramask,
214 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 215 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
215 if (err) 216 if (err)
216 goto segv; 217 goto segv;
217 switch (_NSIG_WORDS) { 218
218 case 4: set.sig[3] = seta[6] + (((long)seta[7]) << 32); 219 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
219 case 3: set.sig[2] = seta[4] + (((long)seta[5]) << 32);
220 case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32);
221 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
222 }
223 set_current_blocked(&set); 220 set_current_blocked(&set);
224 return; 221 return;
225 222
@@ -303,12 +300,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
303 goto segv; 300 goto segv;
304 } 301 }
305 302
306 switch (_NSIG_WORDS) { 303 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
307 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32);
308 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32);
309 case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32);
310 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
311 }
312 set_current_blocked(&set); 304 set_current_blocked(&set);
313 return; 305 return;
314segv: 306segv:
@@ -417,7 +409,7 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
417 void __user *tail; 409 void __user *tail;
418 int sigframe_size; 410 int sigframe_size;
419 u32 psr; 411 u32 psr;
420 unsigned int seta[_COMPAT_NSIG_WORDS]; 412 compat_sigset_t seta;
421 413
422 /* 1. Make sure everything is clean */ 414 /* 1. Make sure everything is clean */
423 synchronize_user_stack(); 415 synchronize_user_stack();
@@ -481,18 +473,14 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
481 err |= __put_user(0, &sf->rwin_save); 473 err |= __put_user(0, &sf->rwin_save);
482 } 474 }
483 475
484 switch (_NSIG_WORDS) { 476 /* If these change we need to know - assignments to seta relies on these sizes */
485 case 4: seta[7] = (oldset->sig[3] >> 32); 477 BUILD_BUG_ON(_NSIG_WORDS != 1);
486 seta[6] = oldset->sig[3]; 478 BUILD_BUG_ON(_COMPAT_NSIG_WORDS != 2);
487 case 3: seta[5] = (oldset->sig[2] >> 32); 479 seta.sig[1] = (oldset->sig[0] >> 32);
488 seta[4] = oldset->sig[2]; 480 seta.sig[0] = oldset->sig[0];
489 case 2: seta[3] = (oldset->sig[1] >> 32); 481
490 seta[2] = oldset->sig[1]; 482 err |= __put_user(seta.sig[0], &sf->info.si_mask);
491 case 1: seta[1] = (oldset->sig[0] >> 32); 483 err |= __copy_to_user(sf->extramask, &seta.sig[1],
492 seta[0] = oldset->sig[0];
493 }
494 err |= __put_user(seta[0], &sf->info.si_mask);
495 err |= __copy_to_user(sf->extramask, seta + 1,
496 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 484 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
497 485
498 if (!wsaved) { 486 if (!wsaved) {
@@ -622,16 +610,8 @@ static int setup_rt_frame32(struct ksignal *ksig, struct pt_regs *regs,
622 /* Setup sigaltstack */ 610 /* Setup sigaltstack */
623 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]); 611 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]);
624 612
625 switch (_NSIG_WORDS) { 613 seta.sig[1] = (oldset->sig[0] >> 32);
626 case 4: seta.sig[7] = (oldset->sig[3] >> 32); 614 seta.sig[0] = oldset->sig[0];
627 seta.sig[6] = oldset->sig[3];
628 case 3: seta.sig[5] = (oldset->sig[2] >> 32);
629 seta.sig[4] = oldset->sig[2];
630 case 2: seta.sig[3] = (oldset->sig[1] >> 32);
631 seta.sig[2] = oldset->sig[1];
632 case 1: seta.sig[1] = (oldset->sig[0] >> 32);
633 seta.sig[0] = oldset->sig[0];
634 }
635 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); 615 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t));
636 616
637 if (!wsaved) { 617 if (!wsaved) {