[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200121160512.70887-4-elver@google.com>
Date: Tue, 21 Jan 2020 17:05:11 +0100
From: Marco Elver <elver@...gle.com>
To: elver@...gle.com
Cc: paulmck@...nel.org, andreyknvl@...gle.com, glider@...gle.com,
dvyukov@...gle.com, kasan-dev@...glegroups.com,
linux-kernel@...r.kernel.org, mark.rutland@....com,
will@...nel.org, peterz@...radead.org, boqun.feng@...il.com,
arnd@...db.de, viro@...iv.linux.org.uk, dja@...ens.net,
christophe.leroy@....fr, mpe@...erman.id.au, mhiramat@...nel.org,
rostedt@...dmis.org, mingo@...nel.org,
christian.brauner@...ntu.com, daniel@...earbox.net,
keescook@...omium.org, cyphar@...har.com,
linux-arch@...r.kernel.org
Subject: [PATCH v2 4/5] iov_iter: 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@...db.de>
Signed-off-by: Marco Elver <elver@...gle.com>
---
v2:
* Use updated instrumented.h, removing post-hooks for user-copies.
---
lib/iov_iter.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index fb29c02c6a3c..614b6999d2da 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -8,6 +8,7 @@
#include <linux/splice.h>
#include <net/checksum.h>
#include <linux/scatterlist.h>
+#include <linux/instrumented.h>
#define PIPE_PARANOIA /* for now */
@@ -138,7 +139,7 @@
static int copyout(void __user *to, const void *from, size_t n)
{
if (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;
@@ -147,7 +148,7 @@ static int copyout(void __user *to, const void *from, size_t n)
static int copyin(void *to, const void __user *from, size_t n)
{
if (access_ok(from, n)) {
- kasan_check_write(to, n);
+ instrument_copy_from_user(to, from, n);
n = raw_copy_from_user(to, from, n);
}
return n;
@@ -639,7 +640,7 @@ EXPORT_SYMBOL(_copy_to_iter);
static int copyout_mcsafe(void __user *to, const void *from, size_t n)
{
if (access_ok(to, n)) {
- kasan_check_read(from, n);
+ instrument_copy_to_user(to, from, n);
n = copy_to_user_mcsafe((__force void *) to, from, n);
}
return n;
--
2.25.0.341.g760bfbb309-goog
Powered by blists - more mailing lists