summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-06-22 23:05:11 +0000
committerjhb <jhb@FreeBSD.org>2001-06-22 23:05:11 +0000
commite5e16e09ad14c1fc1ed934f3146c5c544b03c8d0 (patch)
treebf66bbbe6655542b5ecd03df2b842fdf71bbf1cf /sys/amd64
parent8210b8d106096a99d54127a3dd7994fa47bf8a86 (diff)
downloadFreeBSD-src-e5e16e09ad14c1fc1ed934f3146c5c544b03c8d0.zip
FreeBSD-src-e5e16e09ad14c1fc1ed934f3146c5c544b03c8d0.tar.gz
- Grab the proc lock around CURSIG and postsig(). Don't release the proc
lock until after grabbing the sched_lock to avoid CURSIG racing with psignal. - Don't grab Giant for addupc_task() as it isn't needed. Reported by: tegge (signal race), bde (addupc_task a while back)
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/trap.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index c1a4e2e..5167ceb 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -171,10 +171,12 @@ userret(p, frame, oticks)
{
int sig;
+ PROC_LOCK(p);
while ((sig = CURSIG(p)) != 0)
postsig(sig);
mtx_lock_spin(&sched_lock);
+ PROC_UNLOCK_NOSWITCH(p);
p->p_pri.pri_level = p->p_pri.pri_user;
if (resched_wanted(p)) {
/*
@@ -191,9 +193,11 @@ userret(p, frame, oticks)
mi_switch();
mtx_unlock_spin(&sched_lock);
PICKUP_GIANT();
+ PROC_LOCK(p);
while ((sig = CURSIG(p)) != 0)
postsig(sig);
mtx_lock_spin(&sched_lock);
+ PROC_UNLOCK_NOSWITCH(p);
}
/*
@@ -201,9 +205,6 @@ userret(p, frame, oticks)
*/
if (p->p_sflag & PS_PROFIL) {
mtx_unlock_spin(&sched_lock);
- /* XXX - do we need Giant? */
- if (!mtx_owned(&Giant))
- mtx_lock(&Giant);
addupc_task(p, TRAPF_PC(frame),
(u_int)(p->p_sticks - oticks) * psratio);
} else
OpenPOWER on IntegriCloud