Subject: re: locking botch in kpsignal2()
To: None <tech-kern@netbsd.org>
From: matthew green <mrg@eterna.com.au>
List: tech-kern
Date: 10/17/2006 17:11:22
i guess moving all the callers of ksiginfo_put() after the
SCHED_UNLOCK(s) call, ensuring that only the same cases call it
would work...
this patch makes this test pass and seems to work OK otherwise.
i could also cleanup one of done/out labels, but for now i've
kept it as simple as necessary.
Index: kern_sig.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sig.c,v
retrieving revision 1.230
diff -p -r1.230 kern_sig.c
*** kern_sig.c 12 Oct 2006 01:32:17 -0000 1.230
--- kern_sig.c 17 Oct 2006 07:06:07 -0000
*************** kpsignal2(struct proc *p, const ksiginfo
*** 1354,1382 ****
/*NOTREACHED*/
runfast:
- if (action == SIG_CATCH) {
- ksiginfo_put(p, ksi);
- action = SIG_HOLD;
- }
/*
* Raise priority to at least PUSER.
*/
if (l->l_priority > PUSER)
l->l_priority = PUSER;
run:
- if (action == SIG_CATCH) {
- ksiginfo_put(p, ksi);
- action = SIG_HOLD;
- }
-
setrunnable(l); /* XXXSMP: recurse? */
out:
- if (action == SIG_CATCH)
- ksiginfo_put(p, ksi);
done:
/* XXXSMP: works, but icky */
if (dolock)
SCHED_UNLOCK(s);
}
siginfo_t *
--- 1354,1373 ----
/*NOTREACHED*/
runfast:
/*
* Raise priority to at least PUSER.
*/
if (l->l_priority > PUSER)
l->l_priority = PUSER;
run:
setrunnable(l); /* XXXSMP: recurse? */
out:
done:
/* XXXSMP: works, but icky */
if (dolock)
SCHED_UNLOCK(s);
+ if (action == SIG_CATCH)
+ ksiginfo_put(p, ksi);
}
siginfo_t *