Commit 80aa0fb4 authored by James Yang's avatar James Yang Committed by Benjamin Herrenschmidt

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: default avatarJames Yang <James.Yang@freescale.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent e1b85c17
...@@ -866,6 +866,10 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword) ...@@ -866,6 +866,10 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword)
u8 val; u8 val;
u32 shift = 8 * (3 - (pos & 0x3)); 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)) { switch ((instword & PPC_INST_STRING_MASK)) {
case PPC_INST_LSWX: case PPC_INST_LSWX:
case PPC_INST_LSWI: case PPC_INST_LSWI:
......
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