Call sendsig() with the proc lock held and return with it held.

This commit is contained in:
John Baldwin 2001-09-06 22:20:41 +00:00
parent 588cfa1095
commit df53e91c18
8 changed files with 16 additions and 27 deletions

View File

@ -1163,7 +1163,6 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -1216,7 +1215,6 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
frame->tf_regs[FRAME_A1] = (u_int64_t)sip;
else
frame->tf_regs[FRAME_A1] = code;
PROC_UNLOCK(p);
frame->tf_regs[FRAME_A2] = (u_int64_t)&sip->si_sc;
frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */
alpha_pal_wrusp((unsigned long)sip);
@ -1232,7 +1230,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
struct sigframe sf, *sfp;
int oonstack, rndfsize;
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
#ifdef COMPAT_43
if (SIGISMEMBER(psp->ps_osigset, sig)) {
@ -1305,7 +1303,6 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -1349,7 +1346,6 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
}
else
frame->tf_regs[FRAME_A1] = code;
PROC_UNLOCK(p);
frame->tf_regs[FRAME_A2] = (u_int64_t)&(sfp->sf_uc);
frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */

View File

@ -585,7 +585,7 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
struct sigacts *psp;
p = curproc;
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
frame = p->p_frame;
@ -620,7 +620,6 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -674,6 +673,7 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
frame->tf_regs[FRAME_A3] = (u_int64_t)catcher; /* a3 is pv */
frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
alpha_pal_wrusp((unsigned long)sip);
PROC_LOCK(p);
}

View File

@ -294,7 +294,7 @@ osendsig(catcher, sig, mask, code)
int oonstack;
p = curproc;
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
regs = p->p_frame;
oonstack = sigonstack(regs->tf_esp);
@ -328,7 +328,6 @@ osendsig(catcher, sig, mask, code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -422,6 +421,7 @@ osendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
load_gs(_udatasel);
regs->tf_ss = _udatasel;
PROC_LOCK(p);
}
#endif
@ -440,11 +440,10 @@ sendsig(catcher, sig, mask, code)
int oonstack;
p = curproc;
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
#ifdef COMPAT_43
if (SIGISMEMBER(psp->ps_osigset, sig)) {
PROC_UNLOCK(p);
osendsig(catcher, sig, mask, code);
return;
}
@ -494,7 +493,6 @@ sendsig(catcher, sig, mask, code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -574,6 +572,7 @@ sendsig(catcher, sig, mask, code)
regs->tf_es = _udatasel;
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
}
/*

View File

@ -294,7 +294,7 @@ osendsig(catcher, sig, mask, code)
int oonstack;
p = curproc;
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
regs = p->p_frame;
oonstack = sigonstack(regs->tf_esp);
@ -328,7 +328,6 @@ osendsig(catcher, sig, mask, code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -422,6 +421,7 @@ osendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
load_gs(_udatasel);
regs->tf_ss = _udatasel;
PROC_LOCK(p);
}
#endif
@ -440,11 +440,10 @@ sendsig(catcher, sig, mask, code)
int oonstack;
p = curproc;
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
#ifdef COMPAT_43
if (SIGISMEMBER(psp->ps_osigset, sig)) {
PROC_UNLOCK(p);
osendsig(catcher, sig, mask, code);
return;
}
@ -494,7 +493,6 @@ sendsig(catcher, sig, mask, code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -574,6 +572,7 @@ sendsig(catcher, sig, mask, code)
regs->tf_es = _udatasel;
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
}
/*

View File

@ -215,6 +215,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
struct linux_rt_sigframe *fp, frame;
int oonstack;
PROC_LOCK_ASSERT(p, MA_OWNED);
regs = p->p_frame;
oonstack = sigonstack(regs->tf_esp);
@ -226,7 +227,6 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
/*
* Allocate space for the signal handler context.
*/
PROC_LOCK(p);
if ((p->p_flag & P_ALTSTACK) && !oonstack &&
SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) {
fp = (struct linux_rt_sigframe *)(p->p_sigstk.ss_sp +
@ -258,7 +258,6 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
fp, oonstack);
#endif
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -343,6 +342,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
regs->tf_es = _udatasel;
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
}

View File

@ -418,7 +418,7 @@ svr4_sendsig(catcher, sig, mask, code)
#if defined(DEBUG_SVR4)
printf("svr4_sendsig(%d)\n", sig);
#endif
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
tf = p->p_frame;
@ -495,6 +495,7 @@ svr4_sendsig(catcher, sig, mask, code)
tf->tf_fs = _udatasel;
load_gs(_udatasel);
tf->tf_ss = _udatasel;
PROC_LOCK(p);
#endif
}

View File

@ -752,7 +752,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
u_int64_t sbs = 0;
int oonstack, rndfsize;
PROC_LOCK(p);
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
frame = p->p_frame;
oonstack = sigonstack(frame->tf_r[FRAME_SP]);
@ -844,7 +844,6 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
SIGDELSET(p->p_sigcatch, SIGILL);
SIGDELSET(p->p_sigmask, SIGILL);
psignal(p, SIGILL);
PROC_UNLOCK(p);
return;
}
@ -885,7 +884,6 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
}
else
frame->tf_r[FRAME_R15] = code;
PROC_UNLOCK(p);
frame->tf_r[FRAME_SP] = (u_int64_t)sfp - 16;
frame->tf_r[FRAME_R14] = sig;

View File

@ -1153,10 +1153,8 @@ trapsignal(p, sig, code)
ktrpsig(p->p_tracep, sig, ps->ps_sigact[_SIG_IDX(sig)],
&p->p_sigmask, code);
#endif
PROC_UNLOCK(p); /* XXX ??? */
(*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)], sig,
&p->p_sigmask, code);
PROC_LOCK(p);
SIGSETOR(p->p_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]);
if (!SIGISMEMBER(ps->ps_signodefer, sig))
SIGADDSET(p->p_sigmask, sig);
@ -1693,9 +1691,7 @@ postsig(sig)
p->p_code = 0;
p->p_sig = 0;
}
PROC_UNLOCK(p);
(*p->p_sysent->sv_sendsig)(action, sig, &returnmask, code);
PROC_LOCK(p);
}
}