summaryrefslogtreecommitdiff
path: root/sys/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/machdep.c21
-rw-r--r--sys/i386/linux/linux_sysvec.c16
-rw-r--r--sys/i386/svr4/svr4_machdep.c3
3 files changed, 28 insertions, 12 deletions
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index e5377d4477e6..912035d9ad54 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -295,6 +295,7 @@ osendsig(catcher, sig, mask, code)
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
+ mtx_assert(&psp->ps_mtx, MA_OWNED);
regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
@@ -308,7 +309,6 @@ osendsig(catcher, sig, mask, code)
#endif
} else
fp = (struct osigframe *)regs->tf_esp - 1;
- PROC_UNLOCK(p);
/* Translate the signal if appropriate. */
if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
@@ -317,8 +317,7 @@ osendsig(catcher, sig, mask, code)
/* Build the argument list for the signal handler. */
sf.sf_signum = sig;
sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
- PROC_LOCK(p);
- if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) {
+ if (SIGISMEMBER(psp->ps_siginfo, sig)) {
/* Signal handler installed with SA_SIGINFO. */
sf.sf_arg2 = (register_t)&fp->sf_siginfo;
sf.sf_siginfo.si_signo = sig;
@@ -330,6 +329,7 @@ osendsig(catcher, sig, mask, code)
sf.sf_addr = regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/* Save most if not all of trap frame. */
@@ -402,6 +402,7 @@ osendsig(catcher, sig, mask, code)
load_gs(_udatasel);
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
#endif /* COMPAT_43 */
@@ -424,6 +425,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
+ mtx_assert(&psp->ps_mtx, MA_OWNED);
regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
@@ -447,7 +449,6 @@ freebsd4_sendsig(catcher, sig, mask, code)
#endif
} else
sfp = (struct sigframe4 *)regs->tf_esp - 1;
- PROC_UNLOCK(p);
/* Translate the signal if appropriate. */
if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
@@ -456,8 +457,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
/* Build the argument list for the signal handler. */
sf.sf_signum = sig;
sf.sf_ucontext = (register_t)&sfp->sf_uc;
- PROC_LOCK(p);
- if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) {
+ if (SIGISMEMBER(psp->ps_siginfo, sig)) {
/* Signal handler installed with SA_SIGINFO. */
sf.sf_siginfo = (register_t)&sfp->sf_si;
sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher;
@@ -472,6 +472,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
sf.sf_addr = regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -523,6 +524,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
#endif /* COMPAT_FREEBSD4 */
@@ -545,6 +547,7 @@ sendsig(catcher, sig, mask, code)
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
+ mtx_assert(&psp->ps_mtx, MA_OWNED);
#ifdef COMPAT_FREEBSD4
if (SIGISMEMBER(psp->ps_freebsd4, sig)) {
freebsd4_sendsig(catcher, sig, mask, code);
@@ -585,7 +588,6 @@ sendsig(catcher, sig, mask, code)
sp = (char *)regs->tf_esp - sizeof(struct sigframe);
/* Align to 16 bytes. */
sfp = (struct sigframe *)((unsigned int)sp & ~0xF);
- PROC_UNLOCK(p);
/* Translate the signal if appropriate. */
if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
@@ -594,8 +596,7 @@ sendsig(catcher, sig, mask, code)
/* Build the argument list for the signal handler. */
sf.sf_signum = sig;
sf.sf_ucontext = (register_t)&sfp->sf_uc;
- PROC_LOCK(p);
- if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) {
+ if (SIGISMEMBER(psp->ps_siginfo, sig)) {
/* Signal handler installed with SA_SIGINFO. */
sf.sf_siginfo = (register_t)&sfp->sf_si;
sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher;
@@ -610,6 +611,7 @@ sendsig(catcher, sig, mask, code)
sf.sf_addr = regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -661,6 +663,7 @@ sendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
/*
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 27105bc71b5d..706c944d51c0 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -273,11 +273,14 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
struct thread *td = curthread;
struct proc *p = td->td_proc;
+ struct sigacts *psp;
struct trapframe *regs;
struct l_rt_sigframe *fp, frame;
int oonstack;
PROC_LOCK_ASSERT(p, MA_OWNED);
+ psp = p->p_sigacts;
+ mtx_assert(&psp->ps_mtx, MA_OWNED);
regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
@@ -290,11 +293,12 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
* Allocate space for the signal handler context.
*/
if ((p->p_flag & P_ALTSTACK) && !oonstack &&
- SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) {
+ SIGISMEMBER(psp->ps_sigonstack, sig)) {
fp = (struct l_rt_sigframe *)(p->p_sigstk.ss_sp +
p->p_sigstk.ss_size - sizeof(struct l_rt_sigframe));
} else
fp = (struct l_rt_sigframe *)regs->tf_esp - 1;
+ mtx_unlock(&psp->ps_mtx);
/*
* Build the argument list for the signal handler.
@@ -383,6 +387,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
@@ -401,13 +406,16 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
struct thread *td = curthread;
struct proc *p = td->td_proc;
+ struct sigacts *psp;
struct trapframe *regs;
struct l_sigframe *fp, frame;
l_sigset_t lmask;
int oonstack, i;
PROC_LOCK_ASSERT(p, MA_OWNED);
- if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) {
+ psp = p->p_sigacts;
+ mtx_assert(&psp->ps_mtx, MA_OWNED);
+ if (SIGISMEMBER(psp->ps_siginfo, sig)) {
/* Signal handler installed with SA_SIGINFO. */
linux_rt_sendsig(catcher, sig, mask, code);
return;
@@ -426,11 +434,12 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
* Allocate space for the signal handler context.
*/
if ((p->p_flag & P_ALTSTACK) && !oonstack &&
- SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) {
+ SIGISMEMBER(psp->ps_sigonstack, sig)) {
fp = (struct l_sigframe *)(p->p_sigstk.ss_sp +
p->p_sigstk.ss_size - sizeof(struct l_sigframe));
} else
fp = (struct l_sigframe *)regs->tf_esp - 1;
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -494,6 +503,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
/*
diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c
index d29e37bf45d1..e477629e2c6e 100644
--- a/sys/i386/svr4/svr4_machdep.c
+++ b/sys/i386/svr4/svr4_machdep.c
@@ -428,6 +428,7 @@ svr4_sendsig(catcher, sig, mask, code)
#endif
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
+ mtx_assert(&psp->ps_mtx, MA_OWNED);
tf = td->td_frame;
oonstack = sigonstack(tf->tf_esp);
@@ -443,6 +444,7 @@ svr4_sendsig(catcher, sig, mask, code)
} else {
fp = (struct svr4_sigframe *)tf->tf_esp - 1;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -505,6 +507,7 @@ svr4_sendsig(catcher, sig, mask, code)
load_gs(_udatasel);
tf->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
#endif
}