summaryrefslogtreecommitdiff
path: root/sys/kern/subr_kubsan.c
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2019-11-06 19:16:49 +0000
committeranton <anton@cvs.openbsd.org>2019-11-06 19:16:49 +0000
commit51d8d5da728c744d4a69e8a724bb42617b6f768b (patch)
tree0af41094fc309b166d7d7aa8e034e98a5033e083 /sys/kern/subr_kubsan.c
parente7f032d451e5754333b0d9fa69be4d93ca1a128c (diff)
Use atomic operations consistently while writing to kubsan_slot.
Otherwise, reports might go by unnoticed. Prodded by and ok visa@
Diffstat (limited to 'sys/kern/subr_kubsan.c')
-rw-r--r--sys/kern/subr_kubsan.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/subr_kubsan.c b/sys/kern/subr_kubsan.c
index 3776f48560a..9655500288d 100644
--- a/sys/kern/subr_kubsan.c
+++ b/sys/kern/subr_kubsan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_kubsan.c,v 1.11 2019/11/04 17:51:22 anton Exp $ */
+/* $OpenBSD: subr_kubsan.c,v 1.12 2019/11/06 19:16:48 anton Exp $ */
/*
* Copyright (c) 2019 Anton Lindqvist <anton@openbsd.org>
@@ -708,11 +708,11 @@ again:
}
/* New reports can arrive at any time. */
- if (nslots != kubsan_slot && nslots < KUBSAN_NSLOTS)
- goto again;
-
- kubsan_slot = 0;
- membar_producer();
+ if (atomic_cas_uint(&kubsan_slot, nslots, 0) != nslots) {
+ if (nslots < KUBSAN_NSLOTS)
+ goto again;
+ atomic_swap_uint(&kubsan_slot, 0);
+ }
done:
timeout_add_msec(&kubsan_timo, KUBSAN_INTERVAL);