Skip to content

Commit 41e3ca9

Browse files
keesAlex Shi
authored andcommitted
s390/uaccess: Enable hardened usercopy
Enables CONFIG_HARDENED_USERCOPY checks on s390. Signed-off-by: Kees Cook <keescook@chromium.org> (cherry picked from commit 97433ea4fda62349bfa42089455593cbcb57e06c) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 17427c2 commit 41e3ca9

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ config S390
117117
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
118118
select HAVE_ARCH_AUDITSYSCALL
119119
select HAVE_ARCH_EARLY_PFN_TO_NID
120+
select HAVE_ARCH_HARDENED_USERCOPY
120121
select HAVE_ARCH_JUMP_LABEL
121122
select HAVE_ARCH_SECCOMP_FILTER
122123
select HAVE_ARCH_SOFT_DIRTY

arch/s390/lib/uaccess.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ static inline unsigned long copy_from_user_mvcp(void *x, const void __user *ptr,
104104

105105
unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
106106
{
107+
check_object_size(to, n, false);
107108
if (static_branch_likely(&have_mvcos))
108109
return copy_from_user_mvcos(to, from, n);
109110
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,
177178

178179
unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
179180
{
181+
check_object_size(from, n, true);
180182
if (static_branch_likely(&have_mvcos))
181183
return copy_to_user_mvcos(to, from, n);
182184
return copy_to_user_mvcs(to, from, n);

0 commit comments

Comments
 (0)