linux-sg2042/kernel/kcsan
Marco Elver 1d094cefc3 kcsan: Fix encoding masks and regain address bit
The watchpoint encoding masks for size and address were off-by-one bit
each, with the size mask using 1 unnecessary bit and the address mask
missing 1 bit. However, due to the way the size is shifted into the
encoded watchpoint, we were effectively wasting and never using the
extra bit.

For example, on x86 with PAGE_SIZE==4K, we have 1 bit for the is-write
bit, 14 bits for the size bits, and then 49 bits left for the address.
Prior to this fix we would end up with this usage:

	[ write<1> | size<14> | wasted<1> | address<48> ]

Fix it by subtracting 1 bit from the GENMASK() end and start ranges of
size and address respectively. The added static_assert()s verify that
the masks are as expected. With the fixed version, we get the expected
usage:

	[ write<1> | size<14> |             address<49> ]

Functionally no change is expected, since that extra address bit is
insignificant for enabled architectures.

Acked-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06 17:19:26 -08:00
..
Makefile kcsan: Disable branch tracing in core runtime 2020-06-29 12:04:48 -07:00
atomic.h kcsan: Remove existing special atomic rules 2020-06-29 12:04:48 -07:00
core.c kcsan: Use tracing-safe version of prandom 2020-08-30 21:50:13 -07:00
debugfs.c kcsan: Optimize debugfs stats counters 2020-08-24 15:10:23 -07:00
encoding.h kcsan: Fix encoding masks and regain address bit 2020-11-06 17:19:26 -08:00
kcsan-test.c kcsan: Test support for compound instrumentation 2020-08-24 15:09:58 -07:00
kcsan.h kcsan: Optimize debugfs stats counters 2020-08-24 15:10:23 -07:00
report.c kcsan: Optimize debugfs stats counters 2020-08-24 15:10:23 -07:00
selftest.c kcsan: selftest: Ensure that address is at least PAGE_SIZE 2020-11-02 17:08:50 -08:00