This replaces the KASAN instrumentation with generic instrumentation, implicitly adding KCSAN instrumentation support. For KASAN no functional change is intended.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -2,9 +2,9 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef __LINUX_UACCESS_H__ |
| 3 | 3 | #define __LINUX_UACCESS_H__ |
| 4 | 4 | |
| 5 | +#include <linux/instrumented.h> | |
| 5 | 6 | #include <linux/sched.h> |
| 6 | 7 | #include <linux/thread_info.h> |
| 7 | −#include <linux/kasan-checks.h> | |
| 8 | 8 | |
| 9 | 9 | #define uaccess_kernel() segment_eq(get_fs(), KERNEL_DS) |
| 10 | 10 | |
| @@ -58,7 +58,7 @@ · 47 unmodified lines | ||
| 58 | 58 | static __always_inline __must_check unsigned long |
| 59 | 59 | __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) |
| 60 | 60 | { |
| 61 | − kasan_check_write(to, n); | |
| 61 | + instrument_copy_from_user(to, from, n); | |
| 62 | 62 | check_object_size(to, n, false); |
| 63 | 63 | return raw_copy_from_user(to, from, n); |
| 64 | 64 | } |
| @@ -67,7 +67,7 @@ static __always_inline __must_check unsigned long · 2 unmodified lines | ||
| 67 | 67 | __copy_from_user(void *to, const void __user *from, unsigned long n) |
| 68 | 68 | { |
| 69 | 69 | might_fault(); |
| 70 | − kasan_check_write(to, n); | |
| 70 | + instrument_copy_from_user(to, from, n); | |
| 71 | 71 | check_object_size(to, n, false); |
| 72 | 72 | return raw_copy_from_user(to, from, n); |
| 73 | 73 | } |
| @@ -88,7 +88,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n) · 14 unmodified lines | ||
| 88 | 88 | static __always_inline __must_check unsigned long |
| 89 | 89 | __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) |
| 90 | 90 | { |
| 91 | − kasan_check_read(from, n); | |
| 91 | + instrument_copy_to_user(to, from, n); | |
| 92 | 92 | check_object_size(from, n, true); |
| 93 | 93 | return raw_copy_to_user(to, from, n); |
| 94 | 94 | } |
| @@ -97,7 +97,7 @@ static __always_inline __must_check unsigned long · 2 unmodified lines | ||
| 97 | 97 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
| 98 | 98 | { |
| 99 | 99 | might_fault(); |
| 100 | − kasan_check_read(from, n); | |
| 100 | + instrument_copy_to_user(to, from, n); | |
| 101 | 101 | check_object_size(from, n, true); |
| 102 | 102 | return raw_copy_to_user(to, from, n); |
| 103 | 103 | } |
| @@ -109,7 +109,7 @@ _copy_from_user(void *to, const void __user *from, unsigned long n) · 5 unmodified lines | ||
| 109 | 109 | unsigned long res = n; |
| 110 | 110 | might_fault(); |
| 111 | 111 | if (likely(access_ok(from, n))) { |
| 112 | − kasan_check_write(to, n); | |
| 112 | + instrument_copy_from_user(to, from, n); | |
| 113 | 113 | res = raw_copy_from_user(to, from, n); |
| 114 | 114 | } |
| 115 | 115 | if (unlikely(res)) |
| @@ -127,7 +127,7 @@ _copy_to_user(void __user *to, const void *from, unsigned long n) · 11 unmodified lines | ||
| 127 | 127 | { |
| 128 | 128 | might_fault(); |
| 129 | 129 | if (access_ok(to, n)) { |
| 130 | − kasan_check_read(from, n); | |
| 130 | + instrument_copy_to_user(to, from, n); | |
| 131 | 131 | n = raw_copy_to_user(to, from, n); |
| 132 | 132 | } |
| 133 | 133 | return n; |