diff options
author | Marco Elver <elver@google.com> | 2020-04-24 18:47:29 +0300 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2020-05-06 20:58:46 +0300 |
commit | 19acd03d95dad1f50d06f28179a1866fca431fed (patch) | |
tree | 1f451d663d7d1898ab8dca276e893fd880999d00 /kernel/kcsan | |
parent | 5099a722e9727fe9a93fac51e961735f40e5b6c8 (diff) | |
download | linux-19acd03d95dad1f50d06f28179a1866fca431fed.tar.xz |
kcsan: Add __kcsan_{enable,disable}_current() variants
The __kcsan_{enable,disable}_current() variants only call into KCSAN if
KCSAN is enabled for the current compilation unit. Note: This is
typically not what we want, as we usually want to ensure that even calls
into other functions still have KCSAN disabled.
These variants may safely be used in header files that are shared
between regular kernel code and code that does not link the KCSAN
runtime.
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/kcsan')
-rw-r--r-- | kernel/kcsan/core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/kcsan/core.c b/kernel/kcsan/core.c index a572aae61b98..a73a66cf79df 100644 --- a/kernel/kcsan/core.c +++ b/kernel/kcsan/core.c @@ -625,6 +625,13 @@ void kcsan_enable_current(void) } EXPORT_SYMBOL(kcsan_enable_current); +void kcsan_enable_current_nowarn(void) +{ + if (get_ctx()->disable_count-- == 0) + kcsan_disable_current(); +} +EXPORT_SYMBOL(kcsan_enable_current_nowarn); + void kcsan_nestable_atomic_begin(void) { /* |