Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257270
b: refs/heads/master
c: 9b42962
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and H. Peter Anvin committed Jul 15, 2011
1 parent 93af1b4 commit ee11622
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3982294b0342474ff91472b34c6afb701785f524
refs/heads/master: 9b429620740945363b746414e8b9a84b8119914c
29 changes: 10 additions & 19 deletions trunk/arch/x86/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,15 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,

static int
setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs)
struct pt_regs *regs)
{
int usig = signr_convert(sig);
sigset_t *set = &current->blocked;
int ret;

if (current_thread_info()->status & TS_RESTORE_SIGMASK)
set = &current->saved_sigmask;

/* Set up the stack frame */
if (is_ia32) {
if (ka->sa.sa_flags & SA_SIGINFO)
Expand All @@ -670,12 +674,13 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
return -EFAULT;
}

current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
return ret;
}

static int
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
sigset_t *oldset, struct pt_regs *regs)
struct pt_regs *regs)
{
sigset_t blocked;
int ret;
Expand Down Expand Up @@ -710,7 +715,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
regs->flags &= ~X86_EFLAGS_TF;

ret = setup_rt_frame(sig, ka, info, oldset, regs);
ret = setup_rt_frame(sig, ka, info, regs);

if (ret)
return ret;
Expand Down Expand Up @@ -765,7 +770,6 @@ static void do_signal(struct pt_regs *regs)
struct k_sigaction ka;
siginfo_t info;
int signr;
sigset_t *oldset;

/*
* We want the common case to go fast, which is why we may in certain
Expand All @@ -777,23 +781,10 @@ static void do_signal(struct pt_regs *regs)
if (!user_mode(regs))
return;

if (current_thread_info()->status & TS_RESTORE_SIGMASK)
oldset = &current->saved_sigmask;
else
oldset = &current->blocked;

signr = get_signal_to_deliver(&info, &ka, regs, NULL);
if (signr > 0) {
/* Whee! Actually deliver the signal. */
if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
/*
* 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 TS_RESTORE_SIGMASK flag.
*/
current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
}
handle_signal(signr, &info, &ka, regs);
return;
}

Expand Down Expand Up @@ -821,7 +812,7 @@ static void do_signal(struct pt_regs *regs)
*/
if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
set_current_blocked(&current->saved_sigmask);
}
}

Expand Down

0 comments on commit ee11622

Please sign in to comment.