Commit 1752ae83 authored by Matt Redfearn's avatar Matt Redfearn Committed by Stefan Bader

MIPS: uaccess: Add micromips clobbers to bzero invocation

BugLink: http://bugs.launchpad.net/bugs/1768429

commit b3d7e55c upstream.

The micromips implementation of bzero additionally clobbers registers t7
& t8. Specify this in the clobbers list when invoking bzero.

Fixes: 26c5e07d ("MIPS: microMIPS: Optimise 'memset' core library function.")
Reported-by: default avatarJames Hogan <jhogan@kernel.org>
Signed-off-by: default avatarMatt Redfearn <matt.redfearn@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 3.10+
Patchwork: https://patchwork.linux-mips.org/patch/19110/Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 05a50be9
...@@ -1238,6 +1238,13 @@ __clear_user(void __user *addr, __kernel_size_t size) ...@@ -1238,6 +1238,13 @@ __clear_user(void __user *addr, __kernel_size_t size)
{ {
__kernel_size_t res; __kernel_size_t res;
#ifdef CONFIG_CPU_MICROMIPS
/* micromips memset / bzero also clobbers t7 & t8 */
#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$15", "$24", "$31"
#else
#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
#endif /* CONFIG_CPU_MICROMIPS */
if (eva_kernel_access()) { if (eva_kernel_access()) {
__asm__ __volatile__( __asm__ __volatile__(
"move\t$4, %1\n\t" "move\t$4, %1\n\t"
...@@ -1247,7 +1254,7 @@ __clear_user(void __user *addr, __kernel_size_t size) ...@@ -1247,7 +1254,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
"move\t%0, $6" "move\t%0, $6"
: "=r" (res) : "=r" (res)
: "r" (addr), "r" (size) : "r" (addr), "r" (size)
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"); : bzero_clobbers);
} else { } else {
might_fault(); might_fault();
__asm__ __volatile__( __asm__ __volatile__(
...@@ -1258,7 +1265,7 @@ __clear_user(void __user *addr, __kernel_size_t size) ...@@ -1258,7 +1265,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
"move\t%0, $6" "move\t%0, $6"
: "=r" (res) : "=r" (res)
: "r" (addr), "r" (size) : "r" (addr), "r" (size)
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"); : bzero_clobbers);
} }
return res; return res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment