Commit 3785006a authored by Matt Fleming's avatar Matt Fleming Committed by Linus Torvalds

xtensa: don't mask signals if we fail to setup signal stack

setup_frame() needs to return an indication of whether it succeeded or
failed in setting up the signal stack frame.  If setup_frame() fails then
we must not modify current->blocked.
Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ff6d21e7
...@@ -336,8 +336,8 @@ gen_return_code(unsigned char *codemem) ...@@ -336,8 +336,8 @@ gen_return_code(unsigned char *codemem)
} }
static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs) sigset_t *set, struct pt_regs *regs)
{ {
struct rt_sigframe *frame; struct rt_sigframe *frame;
int err = 0; int err = 0;
...@@ -422,10 +422,11 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -422,10 +422,11 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
current->comm, current->pid, signal, frame, regs->pc); current->comm, current->pid, signal, frame, regs->pc);
#endif #endif
return; return 0;
give_sigsegv: give_sigsegv:
force_sigsegv(sig, current); force_sigsegv(sig, current);
return -EFAULT;
} }
/* /*
...@@ -534,7 +535,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) ...@@ -534,7 +535,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
/* Whee! Actually deliver the signal. */ /* Whee! Actually deliver the signal. */
/* Set up the stack frame */ /* Set up the stack frame */
setup_frame(signr, &ka, &info, oldset, regs); ret = setup_frame(signr, &ka, &info, oldset, regs);
if (ret)
return ret;
spin_lock_irq(&current->sighand->siglock); spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask); sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment