summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2000-12-12 01:14:32 +0000
committerjake <jake@FreeBSD.org>2000-12-12 01:14:32 +0000
commite04de3cdaa20b55e34a44aa9540e200747947d37 (patch)
tree7118da5af73ae9b208c2b8845c541a5f8114eb78 /sys/amd64
parent5791a3790632140a5f2e20a7962b123589408145 (diff)
downloadFreeBSD-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/amd64')
-rw-r--r--sys/amd64/amd64/trap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index fa768ec..5974535 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/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
OpenPOWER on IntegriCloud