OSDN Git Service

Merge tag 'usercopy-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
[android-x86/kernel.git] / arch / arm64 / include / asm / uaccess.h
index 92848b0..c47257c 100644 (file)
@@ -21,6 +21,7 @@
 /*
  * User space memory access functions
  */
+#include <linux/kasan-checks.h>
 #include <linux/string.h>
 #include <linux/thread_info.h>
 
@@ -263,18 +264,22 @@ extern unsigned long __must_check __clear_user(void __user *addr, unsigned long
 
 static inline unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n)
 {
+       kasan_check_write(to, n);
        check_object_size(to, n, false);
        return __arch_copy_from_user(to, from, n);
 }
 
 static inline unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n)
 {
+       kasan_check_read(from, n);
        check_object_size(from, n, true);
        return __arch_copy_to_user(to, from, n);
 }
 
 static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
 {
+       kasan_check_write(to, n);
+
        if (access_ok(VERIFY_READ, from, n)) {
                check_object_size(to, n, false);
                n = __arch_copy_from_user(to, from, n);
@@ -285,6 +290,8 @@ static inline unsigned long __must_check copy_from_user(void *to, const void __u
 
 static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)
 {
+       kasan_check_read(from, n);
+
        if (access_ok(VERIFY_WRITE, to, n)) {
                check_object_size(from, n, true);
                n = __arch_copy_to_user(to, from, n);