kcsan: Fix 0-sized checks
authorMarco Elver <elver@google.com>
Wed, 5 Feb 2020 10:14:19 +0000 (11:14 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 21 Mar 2020 08:42:42 +0000 (09:42 +0100)
commited95f95c86cd53621103d865d62b5e1f96e60edb
tree494951a23a0a3a22bccecb1de3ae460ee31cc1c0
parent8cfbb04fae75260eae07ab8c74c1dcd44294d739
kcsan: Fix 0-sized checks

Instrumentation of arbitrary memory-copy functions, such as user-copies,
may be called with size of 0, which could lead to false positives.

To avoid this, add a comparison in check_access() for size==0, which
will be optimized out for constant sized instrumentation
(__tsan_{read,write}N), and therefore not affect the common-case
fast-path.

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>
kernel/kcsan/core.c
kernel/kcsan/test.c