This patch was hanging around for some time while we were waiting for the compiler situation to improve.. now that all is well again, finally merge it.
···698698 if (try_to_freeze())699699 goto no_signal;700700701701- if (!oldset)701701+ if (test_thread_flag(TIF_RESTORE_SIGMASK))702702+ oldset = ¤t->saved_sigmask;703703+ else if (!oldset)702704 oldset = ¤t->blocked;703705704706 signr = get_signal_to_deliver(&info, &ka, regs, 0);···708706 if (signr > 0) {709707 /* Whee! Actually deliver the signal. */710708 handle_signal(signr, &info, &ka, oldset, regs);709709+710710+ /*711711+ * If a signal was successfully delivered, the saved sigmask712712+ * is in its frame, and we can clear the TIF_RESTORE_SIGMASK713713+ * flag.714714+ */715715+ if (test_thread_flag(TIF_RESTORE_SIGMASK))716716+ clear_thread_flag(TIF_RESTORE_SIGMASK);717717+711718 return 1;712719 }713720···724713 /* Did we come from a system call? */725714 if (regs->syscall_nr >= 0) {726715 /* Restart the system call - no handlers present */727727- if (regs->regs[REG_RET] == -ERESTARTNOHAND ||728728- regs->regs[REG_RET] == -ERESTARTSYS ||729729- regs->regs[REG_RET] == -ERESTARTNOINTR) {716716+ switch (regs->regs[REG_RET]) {717717+ case -ERESTARTNOHAND:718718+ case -ERESTARTSYS:719719+ case -ERESTARTNOINTR:730720 /* Decode Syscall # */731721 regs->regs[REG_RET] = regs->syscall_nr;732722 regs->pc -= 4;723723+ break;724724+725725+ case -ERESTART_RESTARTBLOCK:726726+ regs->regs[REG_RET] = __NR_restart_syscall;727727+ regs->pc -= 4;728728+ break;733729 }734730 }731731+732732+ /* No signal to deliver -- put the saved sigmask back */733733+ if (test_thread_flag(TIF_RESTORE_SIGMASK)) {734734+ clear_thread_flag(TIF_RESTORE_SIGMASK);735735+ sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL);736736+ }737737+735738 return 0;736739}