]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - arch/x86/include/asm/uaccess.h
x86/kasan: instrument user memory access API
[thirdparty/linux.git] / arch / x86 / include / asm / uaccess.h
index 12f9653bde8d968c3374e6f13a2fbc2abacccda0..2982387ba8171e1cd5a7ba2c4b9a800059a50791 100644 (file)
@@ -5,6 +5,7 @@
  */
 #include <linux/errno.h>
 #include <linux/compiler.h>
+#include <linux/kasan-checks.h>
 #include <linux/thread_info.h>
 #include <linux/string.h>
 #include <asm/asm.h>
@@ -721,6 +722,8 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
 
        might_fault();
 
+       kasan_check_write(to, n);
+
        /*
         * While we would like to have the compiler do the checking for us
         * even in the non-constant size case, any false positives there are
@@ -754,6 +757,8 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
 {
        int sz = __compiletime_object_size(from);
 
+       kasan_check_read(from, n);
+
        might_fault();
 
        /* See the comment in copy_from_user() above. */