In r197963, a race with thread being selected for signal delivery

while in kernel mode, and later changing signal mask to block the
signal, was fixed for sigprocmask(2) and ptread_exit(3). The same race
exists for sigreturn(2), setcontext(2) and swapcontext(2) syscalls.

Use kern_sigprocmask() instead of direct manipulation of td_sigmask to
reschedule newly blocked signals, closing the race.

Reviewed by:	davidxu
Tested by:	pho
MFC after:	1 month
This commit is contained in:
Konstantin Belousov 2009-10-27 10:47:58 +00:00
parent 84440afb54
commit d6e029adbe
16 changed files with 77 additions and 185 deletions

View File

@ -415,7 +415,7 @@ sigreturn(td, uap)
ucontext_t uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const ucontext_t *ucp;
ucontext_t *ucp;
long rflags;
int cs, error, ret;
ksiginfo_t ksi;
@ -478,7 +478,6 @@ sigreturn(td, uap)
td->td_pcb->pcb_fsbase = ucp->uc_mcontext.mc_fsbase;
td->td_pcb->pcb_gsbase = ucp->uc_mcontext.mc_gsbase;
PROC_LOCK(p);
#if defined(COMPAT_43)
if (ucp->uc_mcontext.mc_onstack & 1)
td->td_sigstk.ss_flags |= SS_ONSTACK;
@ -486,10 +485,7 @@ sigreturn(td, uap)
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
td->td_pcb->pcb_flags |= PCB_FULLCTX;
td->td_pcb->pcb_full_iret = 1;
return (EJUSTRETURN);

View File

@ -244,10 +244,8 @@ freebsd32_setcontext(struct thread *td, struct freebsd32_setcontext_args *uap)
if (ret == 0) {
ret = ia32_set_mcontext(td, &uc.uc_mcontext);
if (ret == 0) {
SIG_CANTMASK(uc.uc_sigmask);
PROC_LOCK(td->td_proc);
td->td_sigmask = uc.uc_sigmask;
PROC_UNLOCK(td->td_proc);
kern_sigprocmask(td, SIG_SETMASK,
&uc.uc_sigmask, NULL, 0);
}
}
}
@ -273,10 +271,8 @@ freebsd32_swapcontext(struct thread *td, struct freebsd32_swapcontext_args *uap)
if (ret == 0) {
ret = ia32_set_mcontext(td, &uc.uc_mcontext);
if (ret == 0) {
SIG_CANTMASK(uc.uc_sigmask);
PROC_LOCK(td->td_proc);
td->td_sigmask = uc.uc_sigmask;
PROC_UNLOCK(td->td_proc);
kern_sigprocmask(td, SIG_SETMASK,
&uc.uc_sigmask, NULL, 0);
}
}
}
@ -544,9 +540,8 @@ freebsd4_freebsd32_sigreturn(td, uap)
} */ *uap;
{
struct ia32_ucontext4 uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const struct ia32_ucontext4 *ucp;
struct ia32_ucontext4 *ucp;
int cs, eflags, error;
ksiginfo_t ksi;
@ -610,11 +605,7 @@ freebsd4_freebsd32_sigreturn(td, uap)
regs->tf_fs = ucp->uc_mcontext.mc_fs;
regs->tf_gs = ucp->uc_mcontext.mc_gs;
PROC_LOCK(p);
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
td->td_pcb->pcb_full_iret = 1;
return (EJUSTRETURN);
}
@ -631,9 +622,8 @@ freebsd32_sigreturn(td, uap)
} */ *uap;
{
struct ia32_ucontext uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const struct ia32_ucontext *ucp;
struct ia32_ucontext *ucp;
int cs, eflags, error, ret;
ksiginfo_t ksi;
@ -702,11 +692,7 @@ freebsd32_sigreturn(td, uap)
regs->tf_gs = ucp->uc_mcontext.mc_gs;
regs->tf_flags = TF_HASSEGS;
PROC_LOCK(p);
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
td->td_pcb->pcb_full_iret = 1;
return (EJUSTRETURN);
}

View File

@ -565,9 +565,9 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
int
linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
{
struct proc *p = td->td_proc;
struct l_sigframe frame;
struct trapframe *regs;
sigset_t bmask;
l_sigset_t lmask;
int eflags, i;
ksiginfo_t ksi;
@ -623,11 +623,8 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
lmask.__bits[0] = frame.sf_sc.sc_mask;
for (i = 0; i < (LINUX_NSIG_WORDS-1); i++)
lmask.__bits[i+1] = frame.sf_extramask[i];
PROC_LOCK(p);
linux_to_bsd_sigset(&lmask, &td->td_sigmask);
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
linux_to_bsd_sigset(&lmask, &bmask);
kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
/*
* Restore signal context.
@ -666,9 +663,9 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
int
linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
{
struct proc *p = td->td_proc;
struct l_ucontext uc;
struct l_sigcontext *context;
sigset_t bmask;
l_stack_t *lss;
stack_t ss;
struct trapframe *regs;
@ -725,11 +722,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
return(EINVAL);
}
PROC_LOCK(p);
linux_to_bsd_sigset(&uc.uc_sigmask, &td->td_sigmask);
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
linux_to_bsd_sigset(&uc.uc_sigmask, &bmask);
kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
/*
* Restore signal context

View File

@ -605,7 +605,6 @@ sigreturn(td, uap)
const struct __ucontext *sigcntxp;
} */ *uap;
{
struct proc *p = td->td_proc;
struct sigframe sf;
struct trapframe *tf;
int spsr;
@ -627,11 +626,7 @@ sigreturn(td, uap)
set_mcontext(td, &sf.sf_uc.uc_mcontext);
/* Restore signal mask. */
PROC_LOCK(p);
td->td_sigmask = sf.sf_uc.uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &sf.sf_uc.uc_sigmask, NULL, 0);
return (EJUSTRETURN);
}

View File

@ -2482,7 +2482,7 @@ ofreebsd32_sigprocmask(struct thread *td,
int error;
OSIG2SIG(uap->mask, set);
error = kern_sigprocmask(td, uap->how, &set, &oset, 1);
error = kern_sigprocmask(td, uap->how, &set, &oset, SIGPROCMASK_OLD);
SIG2OSIG(oset, td->td_retval[0]);
return (error);
}
@ -2546,15 +2546,11 @@ int
ofreebsd32_sigblock(struct thread *td,
struct ofreebsd32_sigblock_args *uap)
{
struct proc *p = td->td_proc;
sigset_t set;
sigset_t set, oset;
OSIG2SIG(uap->mask, set);
SIG_CANTMASK(set);
PROC_LOCK(p);
SIG2OSIG(td->td_sigmask, td->td_retval[0]);
SIGSETOR(td->td_sigmask, set);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_BLOCK, &set, &oset, 0);
SIG2OSIG(oset, td->td_retval[0]);
return (0);
}
@ -2562,16 +2558,11 @@ int
ofreebsd32_sigsetmask(struct thread *td,
struct ofreebsd32_sigsetmask_args *uap)
{
struct proc *p = td->td_proc;
sigset_t set;
sigset_t set, oset;
OSIG2SIG(uap->mask, set);
SIG_CANTMASK(set);
PROC_LOCK(p);
SIG2OSIG(td->td_sigmask, td->td_retval[0]);
SIGSETLO(td->td_sigmask, set);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &set, &oset, 0);
SIG2OSIG(oset, td->td_retval[0]);
return (0);
}

View File

@ -756,7 +756,6 @@ osigreturn(td, uap)
struct osigcontext sc;
struct trapframe *regs;
struct osigcontext *scp;
struct proc *p = td->td_proc;
int eflags, error;
ksiginfo_t ksi;
@ -856,17 +855,14 @@ osigreturn(td, uap)
regs->tf_eip = scp->sc_pc;
regs->tf_eflags = eflags;
PROC_LOCK(p);
#if defined(COMPAT_43)
if (scp->sc_onstack & 1)
td->td_sigstk.ss_flags |= SS_ONSTACK;
else
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
SIGSETOLD(td->td_sigmask, scp->sc_mask);
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, (sigset_t *)&scp->sc_mask, NULL,
SIGPROCMASK_OLD);
return (EJUSTRETURN);
}
#endif /* COMPAT_43 */
@ -883,9 +879,8 @@ freebsd4_sigreturn(td, uap)
} */ *uap;
{
struct ucontext4 uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const struct ucontext4 *ucp;
struct ucontext4 *ucp;
int cs, eflags, error;
ksiginfo_t ksi;
@ -973,18 +968,13 @@ freebsd4_sigreturn(td, uap)
bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs));
}
PROC_LOCK(p);
#if defined(COMPAT_43)
if (ucp->uc_mcontext.mc_onstack & 1)
td->td_sigstk.ss_flags |= SS_ONSTACK;
else
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
return (EJUSTRETURN);
}
#endif /* COMPAT_FREEBSD4 */
@ -1000,9 +990,8 @@ sigreturn(td, uap)
} */ *uap;
{
ucontext_t uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const ucontext_t *ucp;
ucontext_t *ucp;
int cs, eflags, error, ret;
ksiginfo_t ksi;
@ -1094,7 +1083,6 @@ sigreturn(td, uap)
bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs));
}
PROC_LOCK(p);
#if defined(COMPAT_43)
if (ucp->uc_mcontext.mc_onstack & 1)
td->td_sigstk.ss_flags |= SS_ONSTACK;
@ -1102,10 +1090,7 @@ sigreturn(td, uap)
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
return (EJUSTRETURN);
}

View File

@ -667,10 +667,10 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
int
linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
{
struct proc *p = td->td_proc;
struct l_sigframe frame;
struct trapframe *regs;
l_sigset_t lmask;
sigset_t bmask;
int eflags, i;
ksiginfo_t ksi;
@ -725,11 +725,8 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
lmask.__bits[0] = frame.sf_sc.sc_mask;
for (i = 0; i < (LINUX_NSIG_WORDS-1); i++)
lmask.__bits[i+1] = frame.sf_extramask[i];
PROC_LOCK(p);
linux_to_bsd_sigset(&lmask, &td->td_sigmask);
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
linux_to_bsd_sigset(&lmask, &bmask);
kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
/*
* Restore signal context.
@ -767,9 +764,9 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
int
linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
{
struct proc *p = td->td_proc;
struct l_ucontext uc;
struct l_sigcontext *context;
sigset_t bmask;
l_stack_t *lss;
stack_t ss;
struct trapframe *regs;
@ -826,11 +823,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
return(EINVAL);
}
PROC_LOCK(p);
linux_to_bsd_sigset(&uc.uc_sigmask, &td->td_sigmask);
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
linux_to_bsd_sigset(&uc.uc_sigmask, &bmask);
kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
/*
* Restore signal context

View File

@ -1056,11 +1056,9 @@ sigreturn(struct thread *td,
{
ucontext_t uc;
struct trapframe *tf;
struct proc *p;
struct pcb *pcb;
tf = td->td_frame;
p = td->td_proc;
pcb = td->td_pcb;
/*
@ -1072,17 +1070,13 @@ sigreturn(struct thread *td,
set_mcontext(td, &uc.uc_mcontext);
PROC_LOCK(p);
#if defined(COMPAT_43)
if (sigonstack(tf->tf_special.sp))
td->td_sigstk.ss_flags |= SS_ONSTACK;
else
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = uc.uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
return (EJUSTRETURN);
}

View File

@ -89,10 +89,8 @@ setcontext(struct thread *td, struct setcontext_args *uap)
if (ret == 0) {
ret = set_mcontext(td, &uc.uc_mcontext);
if (ret == 0) {
SIG_CANTMASK(uc.uc_sigmask);
PROC_LOCK(td->td_proc);
td->td_sigmask = uc.uc_sigmask;
PROC_UNLOCK(td->td_proc);
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask,
NULL, 0);
}
}
}
@ -118,10 +116,8 @@ swapcontext(struct thread *td, struct swapcontext_args *uap)
if (ret == 0) {
ret = set_mcontext(td, &uc.uc_mcontext);
if (ret == 0) {
SIG_CANTMASK(uc.uc_sigmask);
PROC_LOCK(td->td_proc);
td->td_sigmask = uc.uc_sigmask;
PROC_UNLOCK(td->td_proc);
kern_sigprocmask(td, SIG_SETMASK,
&uc.uc_sigmask, NULL, 0);
}
}
}

View File

@ -1396,15 +1396,11 @@ osigblock(td, uap)
register struct thread *td;
struct osigblock_args *uap;
{
struct proc *p = td->td_proc;
sigset_t set;
sigset_t set, oset;
OSIG2SIG(uap->mask, set);
SIG_CANTMASK(set);
PROC_LOCK(p);
SIG2OSIG(td->td_sigmask, td->td_retval[0]);
SIGSETOR(td->td_sigmask, set);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_BLOCK, &set, &oset, 0);
SIG2OSIG(oset, td->td_retval[0]);
return (0);
}
@ -1418,16 +1414,11 @@ osigsetmask(td, uap)
struct thread *td;
struct osigsetmask_args *uap;
{
struct proc *p = td->td_proc;
sigset_t set;
sigset_t set, oset;
OSIG2SIG(uap->mask, set);
SIG_CANTMASK(set);
PROC_LOCK(p);
SIG2OSIG(td->td_sigmask, td->td_retval[0]);
SIGSETLO(td->td_sigmask, set);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &set, &oset, 0);
SIG2OSIG(oset, td->td_retval[0]);
return (0);
}
#endif /* COMPAT_43 */
@ -1845,6 +1836,7 @@ void
trapsignal(struct thread *td, ksiginfo_t *ksi)
{
struct sigacts *ps;
sigset_t mask;
struct proc *p;
int sig;
int code;
@ -1868,8 +1860,11 @@ trapsignal(struct thread *td, ksiginfo_t *ksi)
(*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)],
ksi, &td->td_sigmask);
SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]);
if (!SIGISMEMBER(ps->ps_signodefer, sig))
SIGADDSET(td->td_sigmask, sig);
if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
SIGEMPTYSET(mask);
SIGADDSET(mask, sig);
kern_sigprocmask(td, SIG_BLOCK, &mask, NULL, 0);
}
if (SIGISMEMBER(ps->ps_sigreset, sig)) {
/*
* See kern_sigaction() for origin of this code.
@ -2683,7 +2678,7 @@ postsig(sig)
struct sigacts *ps;
sig_t action;
ksiginfo_t ksi;
sigset_t returnmask;
sigset_t returnmask, mask;
KASSERT(sig != 0, ("postsig"));
@ -2738,9 +2733,15 @@ postsig(sig)
} else
returnmask = td->td_sigmask;
SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]);
if (!SIGISMEMBER(ps->ps_signodefer, sig))
SIGADDSET(td->td_sigmask, sig);
kern_sigprocmask(td, SIG_BLOCK,
&ps->ps_catchmask[_SIG_IDX(sig)], NULL,
SIGPROCMASK_PROC_LOCKED);
if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
SIGEMPTYSET(mask);
SIGADDSET(mask, sig);
kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
SIGPROCMASK_PROC_LOCKED);
}
if (SIGISMEMBER(ps->ps_sigreset, sig)) {
/*

View File

@ -213,13 +213,11 @@ int
sigreturn(struct thread *td, struct sigreturn_args *uap)
{
struct trapframe *regs;
const ucontext_t *ucp;
struct proc *p;
ucontext_t *ucp;
ucontext_t uc;
int error;
ucp = &uc;
p = td->td_proc;
error = copyin(uap->sigcntxp, &uc, sizeof(uc));
if (error != 0)
@ -229,7 +227,7 @@ sigreturn(struct thread *td, struct sigreturn_args *uap)
/* #ifdef DEBUG */
if (ucp->uc_mcontext.mc_regs[ZERO] != UCONTEXT_MAGIC) {
printf("sigreturn: pid %d, ucp %p\n", p->p_pid, ucp);
printf("sigreturn: pid %d, ucp %p\n", td->td_proc->p_pid, ucp);
printf(" old sp %x ra %x pc %x\n",
regs->sp, regs->ra, regs->pc);
printf(" new sp %x ra %x pc %x z %x\n",
@ -253,11 +251,8 @@ sigreturn(struct thread *td, struct sigreturn_args *uap)
regs->mullo = ucp->uc_mcontext.mullo;
regs->mulhi = ucp->uc_mcontext.mulhi;
PROC_LOCK(p);
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
return(EJUSTRETURN);
}

View File

@ -686,7 +686,6 @@ osigreturn(td, uap)
struct osigcontext sc;
struct trapframe *regs;
struct osigcontext *scp;
struct proc *p = td->td_proc;
int eflags, error;
ksiginfo_t ksi;
@ -786,17 +785,14 @@ osigreturn(td, uap)
regs->tf_eip = scp->sc_pc;
regs->tf_eflags = eflags;
PROC_LOCK(p);
#if defined(COMPAT_43)
if (scp->sc_onstack & 1)
td->td_sigstk.ss_flags |= SS_ONSTACK;
else
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
SIGSETOLD(td->td_sigmask, scp->sc_mask);
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, (sigset_t *)&scp->sc_mask, NULL,
SIGPROCMASK_OLD);
return (EJUSTRETURN);
}
#endif /* COMPAT_43 */
@ -813,9 +809,8 @@ freebsd4_sigreturn(td, uap)
} */ *uap;
{
struct ucontext4 uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const struct ucontext4 *ucp;
struct ucontext4 *ucp;
int cs, eflags, error;
ksiginfo_t ksi;
@ -903,18 +898,13 @@ freebsd4_sigreturn(td, uap)
bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs));
}
PROC_LOCK(p);
#if defined(COMPAT_43)
if (ucp->uc_mcontext.mc_onstack & 1)
td->td_sigstk.ss_flags |= SS_ONSTACK;
else
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
return (EJUSTRETURN);
}
#endif /* COMPAT_FREEBSD4 */
@ -930,9 +920,8 @@ sigreturn(td, uap)
} */ *uap;
{
ucontext_t uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const ucontext_t *ucp;
ucontext_t *ucp;
int cs, eflags, error, ret;
ksiginfo_t ksi;
@ -1024,18 +1013,14 @@ sigreturn(td, uap)
bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs));
}
PROC_LOCK(p);
#if defined(COMPAT_43)
if (ucp->uc_mcontext.mc_onstack & 1)
td->td_sigstk.ss_flags |= SS_ONSTACK;
else
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
td->td_sigmask = ucp->uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
return (EJUSTRETURN);
}

View File

@ -692,7 +692,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
int
sigreturn(struct thread *td, struct sigreturn_args *uap)
{
struct proc *p;
ucontext_t uc;
int error;
@ -707,12 +706,7 @@ sigreturn(struct thread *td, struct sigreturn_args *uap)
if (error != 0)
return (error);
p = td->td_proc;
PROC_LOCK(p);
td->td_sigmask = uc.uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x",
td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]);

View File

@ -665,7 +665,6 @@ set_mcontext(struct thread *td, const mcontext_t *mcp)
int
sigreturn(struct thread *td, struct sigreturn_args *uap)
{
struct proc *p;
ucontext_t uc;
int error;
@ -680,12 +679,7 @@ sigreturn(struct thread *td, struct sigreturn_args *uap)
if (error != 0)
return (error);
p = td->td_proc;
PROC_LOCK(p);
td->td_sigmask = uc.uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x",
td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]);

View File

@ -653,11 +653,7 @@ sigreturn(struct thread *td, struct sigreturn_args *uap)
if (error != 0)
return (error);
PROC_LOCK(p);
td->td_sigmask = uc.uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
CTR4(KTR_SIG, "sigreturn: return td=%p pc=%#lx sp=%#lx tstate=%#lx",
td, mc->mc_tpc, mc->mc_sp, mc->mc_tstate);

View File

@ -667,11 +667,7 @@ sigreturn(struct thread *td, struct sigreturn_args *uap)
if (error != 0)
return (error);
PROC_LOCK(p);
td->td_sigmask = uc.uc_sigmask;
SIG_CANTMASK(td->td_sigmask);
signotify(td);
PROC_UNLOCK(p);
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
CTR4(KTR_SIG, "sigreturn: return td=%p pc=%#lx sp=%#lx tstate=%#lx",
td, mc->mc_tpc, mc->mc_sp, mc->mc_tstate);