summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2020-05-25 14:00:16 +0000
committeranton <anton@cvs.openbsd.org>2020-05-25 14:00:16 +0000
commitcd0267c73e7950b776f1d66c84d147d319fd139e (patch)
tree53a722899a2d4d9176c2ab89c2b3f6f5c269d416
parentd70921a9eac1db381b557c545e92dc8721303c8a (diff)
Add a comment explaining the interaction between kcovclose() and
kcov_exit().
-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 {