summaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm/uaccess_64.h
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-06-23 15:10:13 -0700
committerKees Cook <keescook@chromium.org>2016-07-26 14:41:52 -0700
commit9d9208a15800f9f06f102f9aac1e8b323c3b8575 (patch)
tree45ec25224b6dae6634bb6fadc7e679c4cae2a404 /arch/sparc/include/asm/uaccess_64.h
parent1d3c1324746fed0e34a5b94d3ed303e7521ed603 (diff)
downloadop-kernel-dev-9d9208a15800f9f06f102f9aac1e8b323c3b8575.zip
op-kernel-dev-9d9208a15800f9f06f102f9aac1e8b323c3b8575.tar.gz
sparc/uaccess: Enable hardened usercopy
Enables CONFIG_HARDENED_USERCOPY checks on sparc. Based on code from PaX and grsecurity. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'arch/sparc/include/asm/uaccess_64.h')
-rw-r--r--arch/sparc/include/asm/uaccess_64.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index e9a51d6..8bda94f 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -210,8 +210,12 @@ unsigned long copy_from_user_fixup(void *to, const void __user *from,
static inline unsigned long __must_check
copy_from_user(void *to, const void __user *from, unsigned long size)
{
- unsigned long ret = ___copy_from_user(to, from, size);
+ unsigned long ret;
+ if (!__builtin_constant_p(size))
+ check_object_size(to, size, false);
+
+ ret = ___copy_from_user(to, from, size);
if (unlikely(ret))
ret = copy_from_user_fixup(to, from, size);
@@ -227,8 +231,11 @@ unsigned long copy_to_user_fixup(void __user *to, const void *from,
static inline unsigned long __must_check
copy_to_user(void __user *to, const void *from, unsigned long size)
{
- unsigned long ret = ___copy_to_user(to, from, size);
+ unsigned long ret;
+ if (!__builtin_constant_p(size))
+ check_object_size(from, size, true);
+ ret = ___copy_to_user(to, from, size);
if (unlikely(ret))
ret = copy_to_user_fixup(to, from, size);
return ret;
OpenPOWER on IntegriCloud