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: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by David Howells and committed by Linus Torvalds 58a47481 bd9384a9

+23 -29
+23 -29
arch/mn10300/mm/misalignment.c
··· 329 329 void *address; 330 330 unsigned tmp, npop, dispsz, loop; 331 331 332 + /* we don't fix up userspace misalignment faults */ 332 333 if (user_mode(regs)) 333 - sp = regs->sp; 334 - else 335 - sp = (unsigned long) regs + sizeof(*regs); 334 + goto bus_error; 335 + 336 + sp = (unsigned long) regs + sizeof(*regs); 336 337 337 338 kdebug("==>misalignment({pc=%lx,sp=%lx})", regs->pc, sp); 338 339 ··· 387 386 } 388 387 389 388 /* didn't manage to find a fixup */ 390 - if (!user_mode(regs)) 391 - printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n", 392 - regs->pc, opcode); 389 + printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n", 390 + regs->pc, opcode); 393 391 394 392 failed: 395 393 set_fs(seg); 396 394 if (die_if_no_fixup("misalignment error", regs, code)) 397 395 return; 398 396 397 + bus_error: 399 398 info.si_signo = SIGBUS; 400 399 info.si_errno = 0; 401 400 info.si_code = BUS_ADRALN; ··· 405 404 406 405 /* error reading opcodes */ 407 406 fetch_error: 408 - if (!user_mode(regs)) 409 - printk(KERN_CRIT 410 - "MISALIGN: %p: fault whilst reading instruction data\n", 411 - pc); 407 + printk(KERN_CRIT 408 + "MISALIGN: %p: fault whilst reading instruction data\n", 409 + pc); 412 410 goto failed; 413 411 414 412 bad_addr_mode: 415 - if (!user_mode(regs)) 416 - printk(KERN_CRIT 417 - "MISALIGN: %lx: unsupported addressing mode %x\n", 418 - regs->pc, opcode); 413 + printk(KERN_CRIT 414 + "MISALIGN: %lx: unsupported addressing mode %x\n", 415 + regs->pc, opcode); 419 416 goto failed; 420 417 421 418 bad_reg_mode: 422 - if (!user_mode(regs)) 423 - printk(KERN_CRIT 424 - "MISALIGN: %lx: unsupported register mode %x\n", 425 - regs->pc, opcode); 419 + printk(KERN_CRIT 420 + "MISALIGN: %lx: unsupported register mode %x\n", 421 + regs->pc, opcode); 426 422 goto failed; 427 423 428 424 unsupported_instruction: 429 - if (!user_mode(regs)) 430 - printk(KERN_CRIT 431 - "MISALIGN: %lx: unsupported instruction %x (%s)\n", 432 - regs->pc, opcode, pop->name); 425 + printk(KERN_CRIT 426 + "MISALIGN: %lx: unsupported instruction %x (%s)\n", 427 + regs->pc, opcode, pop->name); 433 428 goto failed; 434 429 435 430 transfer_failed: ··· 473 476 kdebug("disp=%lx", disp); 474 477 475 478 set_fs(KERNEL_XDS); 476 - if (fixup || regs->epsw & EPSW_nSL) 479 + if (fixup) 477 480 set_fs(seg); 478 481 479 482 tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000; 480 483 if (!tmp) { 481 - if (!user_mode(regs)) 482 - printk(KERN_CRIT 483 - "MISALIGN: %lx:" 484 - " insn not move to/from memory %x\n", 485 - regs->pc, opcode); 484 + printk(KERN_CRIT 485 + "MISALIGN: %lx: insn not move to/from memory %x\n", 486 + regs->pc, opcode); 486 487 goto failed; 487 488 } 488 489 ··· 543 548 misalignment_MOV_Lcc(regs, opcode); 544 549 545 550 set_fs(seg); 546 - return; 547 551 } 548 552 549 553 /*