summaryrefslogtreecommitdiffstats
path: root/lib/usercopy.c
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2020-01-21 17:05:12 +0100
committerIngo Molnar <mingo@kernel.org>2020-03-21 09:41:59 +0100
commit76d6f06c36a3b5cc402eeeb709613cb211fdaa8f (patch)
tree2149fc9058bd079c85c6f64503579135d86e537b /lib/usercopy.c
parentd0ef4c360f7ea33905539b9b36fa2273915703f0 (diff)
downloadlinux-76d6f06c36a3b5cc402eeeb709613cb211fdaa8f.tar.gz
linux-76d6f06c36a3b5cc402eeeb709613cb211fdaa8f.tar.bz2
linux-76d6f06c36a3b5cc402eeeb709613cb211fdaa8f.zip
copy_to_user, copy_from_user: Use generic instrumented.h
This replaces the KASAN instrumentation with generic instrumentation, implicitly adding KCSAN instrumentation support. For KASAN no functional change is intended. Suggested-by: Arnd Bergmann <arnd@arndb.de> 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>
Diffstat (limited to 'lib/usercopy.c')
-rw-r--r--lib/usercopy.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/usercopy.c b/lib/usercopy.c
index cbb4d9ec00f2..4bb1c5e7a3eb 100644
--- a/lib/usercopy.c
+++ b/lib/usercopy.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
-#include <linux/uaccess.h>
#include <linux/bitops.h>
+#include <linux/instrumented.h>
+#include <linux/uaccess.h>
/* out-of-line parts */
@@ -10,7 +11,7 @@ unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n
unsigned long res = n;
might_fault();
if (likely(access_ok(from, n))) {
- kasan_check_write(to, n);
+ instrument_copy_from_user(to, from, n);
res = raw_copy_from_user(to, from, n);
}
if (unlikely(res))
@@ -25,7 +26,7 @@ unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n)
{
might_fault();
if (likely(access_ok(to, n))) {
- kasan_check_read(from, n);
+ instrument_copy_to_user(to, from, n);
n = raw_copy_to_user(to, from, n);
}
return n;