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