summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2021-11-30 14:44:28 +0300
committerPaul E. McKenney <paulmck@kernel.org>2021-12-10 03:42:28 +0300
commitd37d1fa0154ef3920ad1975aadc083cecdf81b3b (patch)
treef8d7d0c880c603a21689fb7ccf1a07d51ce92476
parentd93414e37586691dd2684a7f8ed05fb9cd640f83 (diff)
downloadlinux-d37d1fa0154ef3920ad1975aadc083cecdf81b3b.tar.xz
mm, kcsan: Enable barrier instrumentation
Some memory management calls imply memory barriers that are required to avoid false positives. For example, without the correct instrumentation, we could observe data races of the following variant: T0 | T1 ------------------------+------------------------ | *a = 42; ---+ | kfree(a); | | | | b = kmalloc(..); // b == a <reordered> <-+ | *b = 42; // not a data race! | Therefore, instrument memory barriers in all allocator code currently not being instrumented in a default build. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
-rw-r--r--mm/Makefile2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/Makefile b/mm/Makefile
index d6c0042e3aa0..7919cd7f13f2 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -15,6 +15,8 @@ KCSAN_SANITIZE_slab_common.o := n
KCSAN_SANITIZE_slab.o := n
KCSAN_SANITIZE_slub.o := n
KCSAN_SANITIZE_page_alloc.o := n
+# But enable explicit instrumentation for memory barriers.
+KCSAN_INSTRUMENT_BARRIERS := y
# These files are disabled because they produce non-interesting and/or
# flaky coverage that is not a function of syscall inputs. E.g. slab is out of