kcsan: Instrument memcpy/memset/memmove with newer Clang
authorMarco Elver <elver@google.com>
Mon, 12 Sep 2022 09:45:40 +0000 (11:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:58:48 +0000 (11:58 +0100)
commitae4f70b2fed409b528663a2e2d9de7e140549b1d
treeb2ae1fce17f6bede2a63ec9ec859a2a4e168b98f
parentd01fa993eb7fbc305f0a9c3e8bfac6513efc13b6
kcsan: Instrument memcpy/memset/memmove with newer Clang

commit 7c201739beef1a586d806463f1465429cdce34c5 upstream.

With Clang version 16+, -fsanitize=thread will turn
memcpy/memset/memmove calls in instrumented functions into
__tsan_memcpy/__tsan_memset/__tsan_memmove calls respectively.

Add these functions to the core KCSAN runtime, so that we (a) catch data
races with mem* functions, and (b) won't run into linker errors with
such newer compilers.

Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
[ elver@google.com: adjust check_access() call for v5.15 and earlier. ]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/kcsan/core.c