diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-08-03 10:44:26 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-08-03 10:44:20 -0400 |
commit | 391c62feb1798b6d31bd88076eae649b091ad8bf (patch) | |
tree | d619c3ef05ba53cb7dc5380b5e5d96bfa9c5559d /arch/s390 | |
parent | 7a0e42f168337d4af8fe230c1043cb04786c04c2 (diff) |
[S390] signal: convert to use set_current_blocked()
Convert to use set_current_blocked() like x86.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kernel/compat_signal.c | 43 | ||||
-rw-r--r-- | arch/s390/kernel/signal.c | 59 |
2 files changed, 30 insertions, 72 deletions
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index eee999853a7c..a9a285b8c4ad 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -380,20 +380,13 @@ asmlinkage long sys32_sigreturn(void) | |||
380 | goto badframe; | 380 | goto badframe; |
381 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) | 381 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) |
382 | goto badframe; | 382 | goto badframe; |
383 | |||
384 | sigdelsetmask(&set, ~_BLOCKABLE); | 383 | sigdelsetmask(&set, ~_BLOCKABLE); |
385 | spin_lock_irq(¤t->sighand->siglock); | 384 | set_current_blocked(&set); |
386 | current->blocked = set; | ||
387 | recalc_sigpending(); | ||
388 | spin_unlock_irq(¤t->sighand->siglock); | ||
389 | |||
390 | if (restore_sigregs32(regs, &frame->sregs)) | 385 | if (restore_sigregs32(regs, &frame->sregs)) |
391 | goto badframe; | 386 | goto badframe; |
392 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) | 387 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) |
393 | goto badframe; | 388 | goto badframe; |
394 | |||
395 | return regs->gprs[2]; | 389 | return regs->gprs[2]; |
396 | |||
397 | badframe: | 390 | badframe: |
398 | force_sig(SIGSEGV, current); | 391 | force_sig(SIGSEGV, current); |
399 | return 0; | 392 | return 0; |
@@ -413,31 +406,22 @@ asmlinkage long sys32_rt_sigreturn(void) | |||
413 | goto badframe; | 406 | goto badframe; |
414 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 407 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
415 | goto badframe; | 408 | goto badframe; |
416 | |||
417 | sigdelsetmask(&set, ~_BLOCKABLE); | 409 | sigdelsetmask(&set, ~_BLOCKABLE); |
418 | spin_lock_irq(¤t->sighand->siglock); | 410 | set_current_blocked(&set); |
419 | current->blocked = set; | ||
420 | recalc_sigpending(); | ||
421 | spin_unlock_irq(¤t->sighand->siglock); | ||
422 | |||
423 | if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) | 411 | if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) |
424 | goto badframe; | 412 | goto badframe; |
425 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) | 413 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) |
426 | goto badframe; | 414 | goto badframe; |
427 | |||
428 | err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); | 415 | err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); |
429 | st.ss_sp = compat_ptr(ss_sp); | 416 | st.ss_sp = compat_ptr(ss_sp); |
430 | err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); | 417 | err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); |
431 | err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); | 418 | err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); |
432 | if (err) | 419 | if (err) |
433 | goto badframe; | 420 | goto badframe; |
434 | |||
435 | set_fs (KERNEL_DS); | 421 | set_fs (KERNEL_DS); |
436 | do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]); | 422 | do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]); |
437 | set_fs (old_fs); | 423 | set_fs (old_fs); |
438 | |||
439 | return regs->gprs[2]; | 424 | return regs->gprs[2]; |
440 | |||
441 | badframe: | 425 | badframe: |
442 | force_sig(SIGSEGV, current); | 426 | force_sig(SIGSEGV, current); |
443 | return 0; | 427 | return 0; |
@@ -605,10 +589,10 @@ give_sigsegv: | |||
605 | * OK, we're invoking a handler | 589 | * OK, we're invoking a handler |
606 | */ | 590 | */ |
607 | 591 | ||
608 | int | 592 | int handle_signal32(unsigned long sig, struct k_sigaction *ka, |
609 | handle_signal32(unsigned long sig, struct k_sigaction *ka, | 593 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) |
610 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) | ||
611 | { | 594 | { |
595 | sigset_t blocked; | ||
612 | int ret; | 596 | int ret; |
613 | 597 | ||
614 | /* Set up the stack frame */ | 598 | /* Set up the stack frame */ |
@@ -616,15 +600,12 @@ handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
616 | ret = setup_rt_frame32(sig, ka, info, oldset, regs); | 600 | ret = setup_rt_frame32(sig, ka, info, oldset, regs); |
617 | else | 601 | else |
618 | ret = setup_frame32(sig, ka, oldset, regs); | 602 | ret = setup_frame32(sig, ka, oldset, regs); |
619 | 603 | if (ret) | |
620 | if (ret == 0) { | 604 | return ret; |
621 | spin_lock_irq(¤t->sighand->siglock); | 605 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); |
622 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 606 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
623 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 607 | sigaddset(&blocked, sig); |
624 | sigaddset(¤t->blocked,sig); | 608 | set_current_blocked(&blocked); |
625 | recalc_sigpending(); | 609 | return 0; |
626 | spin_unlock_irq(¤t->sighand->siglock); | ||
627 | } | ||
628 | return ret; | ||
629 | } | 610 | } |
630 | 611 | ||
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index abbb3c3c7aab..38a88b6128be 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -57,17 +57,15 @@ typedef struct | |||
57 | */ | 57 | */ |
58 | SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) | 58 | SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) |
59 | { | 59 | { |
60 | mask &= _BLOCKABLE; | 60 | sigset_t blocked; |
61 | spin_lock_irq(¤t->sighand->siglock); | ||
62 | current->saved_sigmask = current->blocked; | ||
63 | siginitset(¤t->blocked, mask); | ||
64 | recalc_sigpending(); | ||
65 | spin_unlock_irq(¤t->sighand->siglock); | ||
66 | 61 | ||
62 | current->saved_sigmask = current->blocked; | ||
63 | mask &= _BLOCKABLE; | ||
64 | siginitset(&blocked, mask); | ||
65 | set_current_blocked(&blocked); | ||
67 | set_current_state(TASK_INTERRUPTIBLE); | 66 | set_current_state(TASK_INTERRUPTIBLE); |
68 | schedule(); | 67 | schedule(); |
69 | set_thread_flag(TIF_RESTORE_SIGMASK); | 68 | set_thread_flag(TIF_RESTORE_SIGMASK); |
70 | |||
71 | return -ERESTARTNOHAND; | 69 | return -ERESTARTNOHAND; |
72 | } | 70 | } |
73 | 71 | ||
@@ -172,18 +170,11 @@ SYSCALL_DEFINE0(sigreturn) | |||
172 | goto badframe; | 170 | goto badframe; |
173 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) | 171 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) |
174 | goto badframe; | 172 | goto badframe; |
175 | |||
176 | sigdelsetmask(&set, ~_BLOCKABLE); | 173 | sigdelsetmask(&set, ~_BLOCKABLE); |
177 | spin_lock_irq(¤t->sighand->siglock); | 174 | set_current_blocked(&set); |
178 | current->blocked = set; | ||
179 | recalc_sigpending(); | ||
180 | spin_unlock_irq(¤t->sighand->siglock); | ||
181 | |||
182 | if (restore_sigregs(regs, &frame->sregs)) | 175 | if (restore_sigregs(regs, &frame->sregs)) |
183 | goto badframe; | 176 | goto badframe; |
184 | |||
185 | return regs->gprs[2]; | 177 | return regs->gprs[2]; |
186 | |||
187 | badframe: | 178 | badframe: |
188 | force_sig(SIGSEGV, current); | 179 | force_sig(SIGSEGV, current); |
189 | return 0; | 180 | return 0; |
@@ -199,21 +190,14 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
199 | goto badframe; | 190 | goto badframe; |
200 | if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) | 191 | if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) |
201 | goto badframe; | 192 | goto badframe; |
202 | |||
203 | sigdelsetmask(&set, ~_BLOCKABLE); | 193 | sigdelsetmask(&set, ~_BLOCKABLE); |
204 | spin_lock_irq(¤t->sighand->siglock); | 194 | set_current_blocked(&set); |
205 | current->blocked = set; | ||
206 | recalc_sigpending(); | ||
207 | spin_unlock_irq(¤t->sighand->siglock); | ||
208 | |||
209 | if (restore_sigregs(regs, &frame->uc.uc_mcontext)) | 195 | if (restore_sigregs(regs, &frame->uc.uc_mcontext)) |
210 | goto badframe; | 196 | goto badframe; |
211 | |||
212 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, | 197 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, |
213 | regs->gprs[15]) == -EFAULT) | 198 | regs->gprs[15]) == -EFAULT) |
214 | goto badframe; | 199 | goto badframe; |
215 | return regs->gprs[2]; | 200 | return regs->gprs[2]; |
216 | |||
217 | badframe: | 201 | badframe: |
218 | force_sig(SIGSEGV, current); | 202 | force_sig(SIGSEGV, current); |
219 | return 0; | 203 | return 0; |
@@ -385,14 +369,11 @@ give_sigsegv: | |||
385 | return -EFAULT; | 369 | return -EFAULT; |
386 | } | 370 | } |
387 | 371 | ||
388 | /* | 372 | static int handle_signal(unsigned long sig, struct k_sigaction *ka, |
389 | * OK, we're invoking a handler | 373 | siginfo_t *info, sigset_t *oldset, |
390 | */ | 374 | struct pt_regs *regs) |
391 | |||
392 | static int | ||
393 | handle_signal(unsigned long sig, struct k_sigaction *ka, | ||
394 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) | ||
395 | { | 375 | { |
376 | sigset_t blocked; | ||
396 | int ret; | 377 | int ret; |
397 | 378 | ||
398 | /* Set up the stack frame */ | 379 | /* Set up the stack frame */ |
@@ -400,17 +381,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
400 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 381 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
401 | else | 382 | else |
402 | ret = setup_frame(sig, ka, oldset, regs); | 383 | ret = setup_frame(sig, ka, oldset, regs); |
403 | 384 | if (ret) | |
404 | if (ret == 0) { | 385 | return ret; |
405 | spin_lock_irq(¤t->sighand->siglock); | 386 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); |
406 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 387 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
407 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 388 | sigaddset(&blocked, sig); |
408 | sigaddset(¤t->blocked,sig); | 389 | set_current_blocked(&blocked); |
409 | recalc_sigpending(); | 390 | return 0; |
410 | spin_unlock_irq(¤t->sighand->siglock); | ||
411 | } | ||
412 | |||
413 | return ret; | ||
414 | } | 391 | } |
415 | 392 | ||
416 | /* | 393 | /* |