]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - lib/Kconfig.kcsan
Merge branch 'x86/kdump' into locking/kcsan, to resolve conflicts
[mirror_ubuntu-hirsute-kernel.git] / lib / Kconfig.kcsan
1 # SPDX-License-Identifier: GPL-2.0-only
2
3 config HAVE_ARCH_KCSAN
4 bool
5
6 menuconfig KCSAN
7 bool "KCSAN: watchpoint-based dynamic data race detector"
8 depends on HAVE_ARCH_KCSAN && !KASAN && STACKTRACE
9 help
10 Kernel Concurrency Sanitizer is a dynamic data race detector, which
11 uses a watchpoint-based sampling approach to detect races. See
12 <file:Documentation/dev-tools/kcsan.rst> for more details.
13
14 if KCSAN
15
16 config KCSAN_DEBUG
17 bool "Debugging of KCSAN internals"
18
19 config KCSAN_SELFTEST
20 bool "Perform short selftests on boot"
21 default y
22 help
23 Run KCSAN selftests on boot. On test failure, causes the kernel to panic.
24
25 config KCSAN_EARLY_ENABLE
26 bool "Early enable during boot"
27 default y
28 help
29 If KCSAN should be enabled globally as soon as possible. KCSAN can
30 later be enabled/disabled via debugfs.
31
32 config KCSAN_NUM_WATCHPOINTS
33 int "Number of available watchpoints"
34 default 64
35 help
36 Total number of available watchpoints. An address range maps into a
37 specific watchpoint slot as specified in kernel/kcsan/encoding.h.
38 Although larger number of watchpoints may not be usable due to
39 limited number of CPUs, a larger value helps to improve performance
40 due to reducing cache-line contention. The chosen default is a
41 conservative value; we should almost never observe "no_capacity"
42 events (see /sys/kernel/debug/kcsan).
43
44 config KCSAN_UDELAY_TASK
45 int "Delay in microseconds (for tasks)"
46 default 80
47 help
48 For tasks, the microsecond delay after setting up a watchpoint.
49
50 config KCSAN_UDELAY_INTERRUPT
51 int "Delay in microseconds (for interrupts)"
52 default 20
53 help
54 For interrupts, the microsecond delay after setting up a watchpoint.
55 Interrupts have tighter latency requirements, and their delay should
56 be lower than for tasks.
57
58 config KCSAN_DELAY_RANDOMIZE
59 bool "Randomize above delays"
60 default y
61 help
62 If delays should be randomized, where the maximum is KCSAN_UDELAY_*.
63 If false, the chosen delays are always the KCSAN_UDELAY_* values
64 as defined above.
65
66 config KCSAN_SKIP_WATCH
67 int "Skip instructions before setting up watchpoint"
68 default 4000
69 help
70 The number of per-CPU memory operations to skip, before another
71 watchpoint is set up, i.e. one in KCSAN_WATCH_SKIP per-CPU
72 memory operations are used to set up a watchpoint. A smaller value
73 results in more aggressive race detection, whereas a larger value
74 improves system performance at the cost of missing some races.
75
76 config KCSAN_SKIP_WATCH_RANDOMIZE
77 bool "Randomize watchpoint instruction skip count"
78 default y
79 help
80 If instruction skip count should be randomized, where the maximum is
81 KCSAN_WATCH_SKIP. If false, the chosen value is always
82 KCSAN_WATCH_SKIP.
83
84 # Note that, while some of the below options could be turned into boot
85 # parameters, to optimize for the common use-case, we avoid this because: (a)
86 # it would impact performance (and we want to avoid static branch for all
87 # {READ,WRITE}_ONCE, atomic_*, bitops, etc.), and (b) complicate the design
88 # without real benefit. The main purpose of the below options is for use in
89 # fuzzer configs to control reported data races, and they are not expected
90 # to be switched frequently by a user.
91
92 config KCSAN_REPORT_RACE_UNKNOWN_ORIGIN
93 bool "Report races of unknown origin"
94 default y
95 help
96 If KCSAN should report races where only one access is known, and the
97 conflicting access is of unknown origin. This type of race is
98 reported if it was only possible to infer a race due to a data value
99 change while an access is being delayed on a watchpoint.
100
101 config KCSAN_REPORT_VALUE_CHANGE_ONLY
102 bool "Only report races where watcher observed a data value change"
103 default y
104 help
105 If enabled and a conflicting write is observed via a watchpoint, but
106 the data value of the memory location was observed to remain
107 unchanged, do not report the data race.
108
109 config KCSAN_IGNORE_ATOMICS
110 bool "Do not instrument marked atomic accesses"
111 help
112 If enabled, never instruments marked atomic accesses. This results in
113 not reporting data races where one access is atomic and the other is
114 a plain access.
115
116 endif # KCSAN