aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-07-07 14:38:39 -0400
committerKees Cook <keescook@chromium.org>2016-07-26 17:41:52 -0400
commit97433ea4fda62349bfa42089455593cbcb57e06c (patch)
tree308fd5074718b4dfa06d399c4dbf32cdde5956a3
parent9d9208a15800f9f06f102f9aac1e8b323c3b8575 (diff)
s390/uaccess: Enable hardened usercopy
Enables CONFIG_HARDENED_USERCOPY checks on s390. Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/lib/uaccess.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index a8c259059adf..9f694311c9ed 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -122,6 +122,7 @@ config S390
122 select HAVE_ALIGNED_STRUCT_PAGE if SLUB 122 select HAVE_ALIGNED_STRUCT_PAGE if SLUB
123 select HAVE_ARCH_AUDITSYSCALL 123 select HAVE_ARCH_AUDITSYSCALL
124 select HAVE_ARCH_EARLY_PFN_TO_NID 124 select HAVE_ARCH_EARLY_PFN_TO_NID
125 select HAVE_ARCH_HARDENED_USERCOPY
125 select HAVE_ARCH_JUMP_LABEL 126 select HAVE_ARCH_JUMP_LABEL
126 select CPU_NO_EFFICIENT_FFS if !HAVE_MARCH_Z9_109_FEATURES 127 select CPU_NO_EFFICIENT_FFS if !HAVE_MARCH_Z9_109_FEATURES
127 select HAVE_ARCH_SECCOMP_FILTER 128 select HAVE_ARCH_SECCOMP_FILTER
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c
index ae4de559e3a0..6986c20166f0 100644
--- a/arch/s390/lib/uaccess.c
+++ b/arch/s390/lib/uaccess.c
@@ -104,6 +104,7 @@ static inline unsigned long copy_from_user_mvcp(void *x, const void __user *ptr,
104 104
105unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) 105unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
106{ 106{
107 check_object_size(to, n, false);
107 if (static_branch_likely(&have_mvcos)) 108 if (static_branch_likely(&have_mvcos))
108 return copy_from_user_mvcos(to, from, n); 109 return copy_from_user_mvcos(to, from, n);
109 return copy_from_user_mvcp(to, from, n); 110 return copy_from_user_mvcp(to, from, n);
@@ -177,6 +178,7 @@ static inline unsigned long copy_to_user_mvcs(void __user *ptr, const void *x,
177 178
178unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) 179unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
179{ 180{
181 check_object_size(from, n, true);
180 if (static_branch_likely(&have_mvcos)) 182 if (static_branch_likely(&have_mvcos))
181 return copy_to_user_mvcos(to, from, n); 183 return copy_to_user_mvcos(to, from, n);
182 return copy_to_user_mvcs(to, from, n); 184 return copy_to_user_mvcs(to, from, n);