aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/signal.c')
-rw-r--r--arch/um/kernel/signal.c50
1 files changed, 8 insertions, 42 deletions
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index fb12f4c5e649..7362d58efc29 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -15,23 +15,16 @@
EXPORT_SYMBOL(block_signals);
EXPORT_SYMBOL(unblock_signals);
-#define _S(nr) (1<<((nr)-1))
-
-#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
-
/*
* OK, we're invoking a handler
*/
-static int handle_signal(struct pt_regs *regs, unsigned long signr,
- struct k_sigaction *ka, siginfo_t *info,
- sigset_t *oldset)
+static void handle_signal(struct pt_regs *regs, unsigned long signr,
+ struct k_sigaction *ka, siginfo_t *info)
{
+ sigset_t *oldset = sigmask_to_save();
unsigned long sp;
int err;
- /* Always make any pending restarted system calls return -EINTR */
- current_thread_info()->restart_block.fn = do_no_restart_syscall;
-
/* Did we come from a system call? */
if (PT_REGS_SYSCALL_NR(regs) >= 0) {
/* If so, check system call restarting.. */
@@ -68,37 +61,19 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
if (err)
force_sigsegv(signr, current);
else
- block_sigmask(ka, signr);
-
- return err;
+ signal_delivered(signr, info, ka, regs, 0);
}
static int kern_do_signal(struct pt_regs *regs)
{
struct k_sigaction ka_copy;
siginfo_t info;
- sigset_t *oldset;
int sig, handled_sig = 0;
- if (test_thread_flag(TIF_RESTORE_SIGMASK))
- oldset = &current->saved_sigmask;
- else
- oldset = &current->blocked;
-
while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) {
handled_sig = 1;
/* Whee! Actually deliver the signal. */
- if (!handle_signal(regs, sig, &ka_copy, &info, oldset)) {
- /*
- * a signal was successfully delivered; the saved
- * sigmask will have been stored in the signal frame,
- * and will be restored by sigreturn, so we can simply
- * clear the TIF_RESTORE_SIGMASK flag
- */
- if (test_thread_flag(TIF_RESTORE_SIGMASK))
- clear_thread_flag(TIF_RESTORE_SIGMASK);
- break;
- }
+ handle_signal(regs, sig, &ka_copy, &info);
}
/* Did we come from a system call? */
@@ -134,10 +109,8 @@ static int kern_do_signal(struct pt_regs *regs)
* if there's no signal to deliver, we just put the saved sigmask
* back
*/
- if (!handled_sig && test_thread_flag(TIF_RESTORE_SIGMASK)) {
- clear_thread_flag(TIF_RESTORE_SIGMASK);
- sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
- }
+ if (!handled_sig)
+ restore_saved_sigmask();
return handled_sig;
}
@@ -152,15 +125,8 @@ int do_signal(void)
long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
{
sigset_t blocked;
-
- mask &= _BLOCKABLE;
siginitset(&blocked, mask);
- set_current_blocked(&blocked);
-
- current->state = TASK_INTERRUPTIBLE;
- schedule();
- set_thread_flag(TIF_RESTORE_SIGMASK);
- return -ERESTARTNOHAND;
+ return sigsuspend(&blocked);
}
long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)