aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJames Yang <James.Yang@freescale.com>2013-06-25 11:41:05 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-30 15:49:40 +1000
commit80aa0fb4940bf8ee52bcb574d74459a7aea45621 (patch)
tree6b110dea572ce2a63e4cd47bf95ede1e9a8b2ee4 /arch
parente1b85c17bf3e4f2ecbf9ec824c4048a06078100b (diff)
downloadlinux-stericsson-80aa0fb4940bf8ee52bcb574d74459a7aea45621.tar.gz
powerpc: Fix string instr. emulation for 32-bit processes on ppc64
String instruction emulation would erroneously result in a segfault if the upper bits of the EA are set and is so high that it fails access check. Truncate the EA to 32 bits if the process is 32-bit. Signed-off-by: James Yang <James.Yang@freescale.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/traps.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 071f6e040eb2..300daf3e7ab0 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -866,6 +866,10 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword)
u8 val;
u32 shift = 8 * (3 - (pos & 0x3));
+ /* if process is 32-bit, clear upper 32 bits of EA */
+ if ((regs->msr & MSR_64BIT) == 0)
+ EA &= 0xFFFFFFFF;
+
switch ((instword & PPC_INST_STRING_MASK)) {
case PPC_INST_LSWX:
case PPC_INST_LSWI: