Commit 58a47481 authored by David Howells's avatar David Howells Committed by Linus Torvalds

MN10300: Don't do misalignment handling for userspace

Don't do misalignment handling for userspace misalignment faults: just
generate an appropriate SIGBUS instead.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bd9384a9
...@@ -329,9 +329,10 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) ...@@ -329,9 +329,10 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
void *address; void *address;
unsigned tmp, npop, dispsz, loop; unsigned tmp, npop, dispsz, loop;
/* we don't fix up userspace misalignment faults */
if (user_mode(regs)) if (user_mode(regs))
sp = regs->sp; goto bus_error;
else
sp = (unsigned long) regs + sizeof(*regs); sp = (unsigned long) regs + sizeof(*regs);
kdebug("==>misalignment({pc=%lx,sp=%lx})", regs->pc, sp); kdebug("==>misalignment({pc=%lx,sp=%lx})", regs->pc, sp);
...@@ -386,7 +387,6 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) ...@@ -386,7 +387,6 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
} }
/* didn't manage to find a fixup */ /* didn't manage to find a fixup */
if (!user_mode(regs))
printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n", printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n",
regs->pc, opcode); regs->pc, opcode);
...@@ -395,6 +395,7 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) ...@@ -395,6 +395,7 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
if (die_if_no_fixup("misalignment error", regs, code)) if (die_if_no_fixup("misalignment error", regs, code))
return; return;
bus_error:
info.si_signo = SIGBUS; info.si_signo = SIGBUS;
info.si_errno = 0; info.si_errno = 0;
info.si_code = BUS_ADRALN; info.si_code = BUS_ADRALN;
...@@ -404,28 +405,24 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) ...@@ -404,28 +405,24 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
/* error reading opcodes */ /* error reading opcodes */
fetch_error: fetch_error:
if (!user_mode(regs))
printk(KERN_CRIT printk(KERN_CRIT
"MISALIGN: %p: fault whilst reading instruction data\n", "MISALIGN: %p: fault whilst reading instruction data\n",
pc); pc);
goto failed; goto failed;
bad_addr_mode: bad_addr_mode:
if (!user_mode(regs))
printk(KERN_CRIT printk(KERN_CRIT
"MISALIGN: %lx: unsupported addressing mode %x\n", "MISALIGN: %lx: unsupported addressing mode %x\n",
regs->pc, opcode); regs->pc, opcode);
goto failed; goto failed;
bad_reg_mode: bad_reg_mode:
if (!user_mode(regs))
printk(KERN_CRIT printk(KERN_CRIT
"MISALIGN: %lx: unsupported register mode %x\n", "MISALIGN: %lx: unsupported register mode %x\n",
regs->pc, opcode); regs->pc, opcode);
goto failed; goto failed;
unsupported_instruction: unsupported_instruction:
if (!user_mode(regs))
printk(KERN_CRIT printk(KERN_CRIT
"MISALIGN: %lx: unsupported instruction %x (%s)\n", "MISALIGN: %lx: unsupported instruction %x (%s)\n",
regs->pc, opcode, pop->name); regs->pc, opcode, pop->name);
...@@ -476,15 +473,13 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) ...@@ -476,15 +473,13 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
kdebug("disp=%lx", disp); kdebug("disp=%lx", disp);
set_fs(KERNEL_XDS); set_fs(KERNEL_XDS);
if (fixup || regs->epsw & EPSW_nSL) if (fixup)
set_fs(seg); set_fs(seg);
tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000; tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000;
if (!tmp) { if (!tmp) {
if (!user_mode(regs))
printk(KERN_CRIT printk(KERN_CRIT
"MISALIGN: %lx:" "MISALIGN: %lx: insn not move to/from memory %x\n",
" insn not move to/from memory %x\n",
regs->pc, opcode); regs->pc, opcode);
goto failed; goto failed;
} }
...@@ -548,7 +543,6 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) ...@@ -548,7 +543,6 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
misalignment_MOV_Lcc(regs, opcode); misalignment_MOV_Lcc(regs, opcode);
set_fs(seg); set_fs(seg);
return;
} }
/* /*
......
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