Skip to content

Commit 5dc62fd

Browse files
James Hoganralfbaechle
authored andcommitted
MIPS: uaccess: Fix strlen_user with EVA
The strlen_user() function calls __strlen_kernel_asm in both branches of the eva_kernel_access() conditional. For EVA it should be calling __strlen_user_eva for user accesses, otherwise it will load from the kernel address space instead of the user address space, and the access checking will likely be ineffective at preventing it due to EVA's overlapping user and kernel address spaces. This was found after extending the test_user_copy module to cover user string access functions, which gave the following error with EVA: test_user_copy: illegal strlen_user passed Fortunately the use of strlen_user() has been all but eradicated from the mainline kernel, so only out of tree modules could be affected. Fixes: e3a9b07 ("MIPS: asm: uaccess: Add EVA support for str*_user operations") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com> Cc: linux-mips@linux-mips.org Cc: <stable@vger.kernel.org> # 3.15.x- Patchwork: https://patchwork.linux-mips.org/patch/10842/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 4ef7675 commit 5dc62fd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎arch/mips/include/asm/uaccess.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ static inline long strlen_user(const char __user *s)
13841384
might_fault();
13851385
__asm__ __volatile__(
13861386
"move\t$4, %1\n\t"
1387-
__MODULE_JAL(__strlen_kernel_asm)
1387+
__MODULE_JAL(__strlen_user_asm)
13881388
"move\t%0, $2"
13891389
: "=r" (res)
13901390
: "r" (s)

0 commit comments

Comments
 (0)