diff options
Diffstat (limited to 'arch/powerpc/kernel/signal_64.c')
-rw-r--r-- | arch/powerpc/kernel/signal_64.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index a4a6812e815e..b3193116e686 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -520,11 +520,15 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
520 | if (test_thread_flag(TIF_32BIT)) | 520 | if (test_thread_flag(TIF_32BIT)) |
521 | return do_signal32(oldset, regs); | 521 | return do_signal32(oldset, regs); |
522 | 522 | ||
523 | if (!oldset) | 523 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
524 | oldset = ¤t->saved_sigmask; | ||
525 | else if (!oldset) | ||
524 | oldset = ¤t->blocked; | 526 | oldset = ¤t->blocked; |
525 | 527 | ||
526 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 528 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
527 | if (signr > 0) { | 529 | if (signr > 0) { |
530 | int ret; | ||
531 | |||
528 | /* Whee! Actually deliver the signal. */ | 532 | /* Whee! Actually deliver the signal. */ |
529 | if (TRAP(regs) == 0x0C00) | 533 | if (TRAP(regs) == 0x0C00) |
530 | syscall_restart(regs, &ka); | 534 | syscall_restart(regs, &ka); |
@@ -537,7 +541,14 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
537 | if (current->thread.dabr) | 541 | if (current->thread.dabr) |
538 | set_dabr(current->thread.dabr); | 542 | set_dabr(current->thread.dabr); |
539 | 543 | ||
540 | return handle_signal(signr, &ka, &info, oldset, regs); | 544 | ret = handle_signal(signr, &ka, &info, oldset, regs); |
545 | |||
546 | /* If a signal was successfully delivered, the saved sigmask is in | ||
547 | its frame, and we can clear the TIF_RESTORE_SIGMASK flag */ | ||
548 | if (ret && test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
549 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
550 | |||
551 | return ret; | ||
541 | } | 552 | } |
542 | 553 | ||
543 | if (TRAP(regs) == 0x0C00) { /* System Call! */ | 554 | if (TRAP(regs) == 0x0C00) { /* System Call! */ |
@@ -553,6 +564,11 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
553 | regs->result = 0; | 564 | regs->result = 0; |
554 | } | 565 | } |
555 | } | 566 | } |
567 | /* No signal to deliver -- put the saved sigmask back */ | ||
568 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | ||
569 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
570 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
571 | } | ||
556 | 572 | ||
557 | return 0; | 573 | return 0; |
558 | } | 574 | } |