Commit 58563817 authored by Markos Chandras's avatar Markos Chandras Committed by Ralf Baechle

MIPS: asm: uaccess: Add v1 register to clobber list on EVA

When EVA is turned on and prefetching is being used in memcpy.S,
the v1 register is being used as a helper register to the PREFE
instruction. However, v1 ($3) was not in the clobber list, which
means that the compiler did not preserve it across function calls,
and that could corrupt the value of the register leading to all
sorts of userland crashes. We fix this problem by using the
DADDI_SCRATCH macro to define the clobbered register when
CONFIG_EVA && CONFIG_CPU_HAS_PREFETCH are enabled.
Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
Cc: <stable@vger.kernel.org> # v3.15+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8510/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent bbaf113a
...@@ -773,10 +773,11 @@ extern void __put_user_unaligned_unknown(void); ...@@ -773,10 +773,11 @@ extern void __put_user_unaligned_unknown(void);
"jal\t" #destination "\n\t" "jal\t" #destination "\n\t"
#endif #endif
#ifndef CONFIG_CPU_DADDI_WORKAROUNDS #if defined(CONFIG_CPU_DADDI_WORKAROUNDS) || (defined(CONFIG_EVA) && \
#define DADDI_SCRATCH "$0" defined(CONFIG_CPU_HAS_PREFETCH))
#else
#define DADDI_SCRATCH "$3" #define DADDI_SCRATCH "$3"
#else
#define DADDI_SCRATCH "$0"
#endif #endif
extern size_t __copy_user(void *__to, const void *__from, size_t __n); extern size_t __copy_user(void *__to, const void *__from, size_t __n);
......
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