]> git.baikalelectronics.ru Git - kernel.git/commit
kcsan: Introduce KCSAN_ACCESS_ASSERT access type
authorMarco Elver <elver@google.com>
Thu, 6 Feb 2020 15:46:24 +0000 (16:46 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 21 Mar 2020 08:42:50 +0000 (09:42 +0100)
commit3d3f0063eed1e36cc680f4ace50fd0446ca4e4b8
tree933ba4e438b34e09501ad93e303b77c1f50084ea
parent476d6f279775ce6c25c8daf7d1e5f2d38440798d
kcsan: Introduce KCSAN_ACCESS_ASSERT access type

The KCSAN_ACCESS_ASSERT access type may be used to introduce dummy reads
and writes to assert certain properties of concurrent code, where bugs
could not be detected as normal data races.

For example, a variable that is only meant to be written by a single
CPU, but may be read (without locking) by other CPUs must still be
marked properly to avoid data races. However, concurrent writes,
regardless if WRITE_ONCE() or not, would be a bug. Using
kcsan_check_access(&x, sizeof(x), KCSAN_ACCESS_ASSERT) would allow
catching such bugs.

To support KCSAN_ACCESS_ASSERT the following notable changes were made:

  * If an access is of type KCSAN_ASSERT_ACCESS, disable various filters
    that only apply to data races, so that all races that KCSAN observes are
    reported.
  * Bug reports that involve an ASSERT access type will be reported as
    "KCSAN: assert: race in ..." instead of "data-race"; this will help
    more easily distinguish them.
  * Update a few comments to just mention 'races' where we do not always
    mean pure data races.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/kcsan-checks.h
kernel/kcsan/core.c
kernel/kcsan/debugfs.c
kernel/kcsan/kcsan.h
kernel/kcsan/report.c
lib/Kconfig.kcsan