summaryrefslogtreecommitdiffstats
path: root/sys/dev/kcov.c
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2020-05-25 14:00:15 +0000
committeranton <anton@openbsd.org>2020-05-25 14:00:15 +0000
commita96435ee8348abf4f4e53f24b98434bd7f0ff368 (patch)
treed0cc4a9b03808ac02e371ab6c1b96d0394ccdd16 /sys/dev/kcov.c
parentUse <dev/clock_subr.h> in mcclock(4). (diff)
downloadwireguard-openbsd-a96435ee8348abf4f4e53f24b98434bd7f0ff368.tar.xz
wireguard-openbsd-a96435ee8348abf4f4e53f24b98434bd7f0ff368.zip
Add a comment explaining the interaction between kcovclose() and
kcov_exit().
Diffstat (limited to 'sys/dev/kcov.c')
-rw-r--r--sys/dev/kcov.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/kcov.c b/sys/dev/kcov.c
index fa1ce1b6dc5..12d94dbca1e 100644
--- a/sys/dev/kcov.c
+++ b/sys/dev/kcov.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kcov.c,v 1.18 2020/05/17 08:46:05 anton Exp $ */
+/* $OpenBSD: kcov.c,v 1.19 2020/05/25 14:00:15 anton Exp $ */
/*
* Copyright (c) 2018 Anton Lindqvist <anton@openbsd.org>
@@ -235,6 +235,10 @@ kcovclose(dev_t dev, int flag, int mode, struct proc *p)
return (EINVAL);
if (kd->kd_state == KCOV_STATE_TRACE) {
+ /*
+ * Another thread is currently using the kcov descriptor,
+ * postpone freeing to kcov_exit().
+ */
kd->kd_state = KCOV_STATE_DYING;
kd->kd_mode = KCOV_MODE_NONE;
} else {