diff options
author | Kees Cook <keescook@chromium.org> | 2016-09-06 14:56:01 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-09-06 15:16:42 -0400 |
commit | e6971009a95a74f28c58bbae415c40effad1226c (patch) | |
tree | 3a58fac62cffea1cc0b535482f016b56cd609884 | |
parent | 46738ab31fe668ea1d4413dd459af2632f6fef8d (diff) |
x86/uaccess: force copy_*_user() to be inlined
As already done with __copy_*_user(), mark copy_*_user() as __always_inline.
Without this, the checks for things like __builtin_const_p() won't work
consistently in either hardened usercopy nor the recent adjustments for
detecting usercopy overflows at compile time.
The change in kernel text size is detectable, but very small:
text data bss dec hex filename
12118735 5768608 14229504 32116847 1ea106f vmlinux.before
12120207 5768608 14229504 32118319 1ea162f vmlinux.after
Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | arch/x86/include/asm/uaccess.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index c3f291195294..e3af86f58eaf 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -705,7 +705,7 @@ static inline void copy_user_overflow(int size, unsigned long count) | |||
705 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); | 705 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); |
706 | } | 706 | } |
707 | 707 | ||
708 | static inline unsigned long __must_check | 708 | static __always_inline unsigned long __must_check |
709 | copy_from_user(void *to, const void __user *from, unsigned long n) | 709 | copy_from_user(void *to, const void __user *from, unsigned long n) |
710 | { | 710 | { |
711 | int sz = __compiletime_object_size(to); | 711 | int sz = __compiletime_object_size(to); |
@@ -725,7 +725,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n) | |||
725 | return n; | 725 | return n; |
726 | } | 726 | } |
727 | 727 | ||
728 | static inline unsigned long __must_check | 728 | static __always_inline unsigned long __must_check |
729 | copy_to_user(void __user *to, const void *from, unsigned long n) | 729 | copy_to_user(void __user *to, const void *from, unsigned long n) |
730 | { | 730 | { |
731 | int sz = __compiletime_object_size(from); | 731 | int sz = __compiletime_object_size(from); |