aboutsummaryrefslogtreecommitdiff
path: root/lib/test_string.c
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2020-11-06 10:34:56 +0100
committerPaul E. McKenney <paulmck@kernel.org>2020-11-06 17:19:26 -0800
commit1d094cefc37e5ed4dec44a41841c8628f6b548a2 (patch)
tree4499d118d7343577dd579268fc8dd97ca34b3769 /lib/test_string.c
parent55a2346c7ac4bbf6ee6972394237bf31e29a1c05 (diff)
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>
Diffstat (limited to 'lib/test_string.c')
0 files changed, 0 insertions, 0 deletions