diff options
author | jake <jake@FreeBSD.org> | 2000-12-12 01:14:32 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2000-12-12 01:14:32 +0000 |
commit | e04de3cdaa20b55e34a44aa9540e200747947d37 (patch) | |
tree | 7118da5af73ae9b208c2b8845c541a5f8114eb78 /sys/kern/subr_trap.c | |
parent | 5791a3790632140a5f2e20a7962b123589408145 (diff) | |
download | FreeBSD-src-e04de3cdaa20b55e34a44aa9540e200747947d37.zip FreeBSD-src-e04de3cdaa20b55e34a44aa9540e200747947d37.tar.gz |
- Add code to detect if a system call returns with locks other than Giant
held and panic if so (conditional on witness).
- Change witness_list to return the number of locks held so this is easier.
- Add kern/syscalls.c to the kernel build if witness is defined so that the
panic message can contain the name of the offending system call.
- Add assertions that Giant and sched_lock are not held when returning from
a system call, which were missing for alpha and ia64.
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r-- | sys/kern/subr_trap.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index fa768ec..5974535 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -164,6 +164,10 @@ static int panic_on_nmi = 1; SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RW, &panic_on_nmi, 0, "Panic on NMI"); +#ifdef WITNESS +extern char *syscallnames[]; +#endif + static __inline int userret(p, frame, oticks, have_giant) struct proc *p; @@ -1221,6 +1225,12 @@ bad: mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); +#ifdef WITNESS + if (witness_list(p)) { + panic("system call %s returning with mutex(s) held\n", + syscallnames[code]); + } +#endif } void |