hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/m68k/kernel/traps.c
....@@ -30,15 +30,15 @@
3030 #include <linux/init.h>
3131 #include <linux/ptrace.h>
3232 #include <linux/kallsyms.h>
33
+#include <linux/extable.h>
3334
3435 #include <asm/setup.h>
3536 #include <asm/fpu.h>
3637 #include <linux/uaccess.h>
3738 #include <asm/traps.h>
38
-#include <asm/pgalloc.h>
3939 #include <asm/machdep.h>
4040 #include <asm/siginfo.h>
41
-
41
+#include <asm/tlbflush.h>
4242
4343 static const char *vec_names[] = {
4444 [VEC_RESETSP] = "RESET SP",
....@@ -431,7 +431,7 @@
431431 pr_err("BAD KERNEL BUSERR\n");
432432
433433 die_if_kernel("Oops", &fp->ptregs,0);
434
- force_sig(SIGKILL, current);
434
+ force_sig(SIGKILL);
435435 return;
436436 }
437437 } else {
....@@ -463,7 +463,7 @@
463463 !(ssw & RW) ? "write" : "read", addr,
464464 fp->ptregs.pc);
465465 die_if_kernel ("Oops", &fp->ptregs, buserr_type);
466
- force_sig (SIGBUS, current);
466
+ force_sig (SIGBUS);
467467 return;
468468 }
469469
....@@ -493,7 +493,7 @@
493493 do_page_fault (&fp->ptregs, addr, 0);
494494 } else {
495495 pr_debug("protection fault on insn access (segv).\n");
496
- force_sig (SIGSEGV, current);
496
+ force_sig (SIGSEGV);
497497 }
498498 }
499499 #else
....@@ -550,7 +550,8 @@
550550 errorcode |= 2;
551551
552552 if (mmusr & (MMU_I | MMU_WP)) {
553
- if (ssw & 4) {
553
+ /* We might have an exception table for this PC */
554
+ if (ssw & 4 && !search_exception_tables(fp->ptregs.pc)) {
554555 pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
555556 ssw & RW ? "read" : "write",
556557 fp->un.fmtb.daddr,
....@@ -571,7 +572,7 @@
571572 !(ssw & RW) ? "write" : "read", addr,
572573 fp->ptregs.pc);
573574 die_if_kernel("Oops",&fp->ptregs,mmusr);
574
- force_sig(SIGSEGV, current);
575
+ force_sig(SIGSEGV);
575576 return;
576577 } else {
577578 #if 0
....@@ -598,7 +599,7 @@
598599 #endif
599600 pr_debug("Unknown SIGSEGV - 1\n");
600601 die_if_kernel("Oops",&fp->ptregs,mmusr);
601
- force_sig(SIGSEGV, current);
602
+ force_sig(SIGSEGV);
602603 return;
603604 }
604605
....@@ -621,7 +622,7 @@
621622 buserr:
622623 pr_err("BAD KERNEL BUSERR\n");
623624 die_if_kernel("Oops",&fp->ptregs,0);
624
- force_sig(SIGKILL, current);
625
+ force_sig(SIGKILL);
625626 return;
626627 }
627628
....@@ -660,7 +661,7 @@
660661 addr, fp->ptregs.pc);
661662 pr_debug("Unknown SIGSEGV - 2\n");
662663 die_if_kernel("Oops",&fp->ptregs,mmusr);
663
- force_sig(SIGSEGV, current);
664
+ force_sig(SIGSEGV);
664665 return;
665666 }
666667
....@@ -804,20 +805,20 @@
804805 default:
805806 die_if_kernel("bad frame format",&fp->ptregs,0);
806807 pr_debug("Unknown SIGSEGV - 4\n");
807
- force_sig(SIGSEGV, current);
808
+ force_sig(SIGSEGV);
808809 }
809810 }
810811
811812
812813 static int kstack_depth_to_print = 48;
813814
814
-void show_trace(unsigned long *stack)
815
+static void show_trace(unsigned long *stack, const char *loglvl)
815816 {
816817 unsigned long *endstack;
817818 unsigned long addr;
818819 int i;
819820
820
- pr_info("Call Trace:");
821
+ printk("%sCall Trace:", loglvl);
821822 addr = (unsigned long)stack + THREAD_SIZE - 1;
822823 endstack = (unsigned long *)(addr & -THREAD_SIZE);
823824 i = 0;
....@@ -846,7 +847,6 @@
846847 void show_registers(struct pt_regs *regs)
847848 {
848849 struct frame *fp = (struct frame *)regs;
849
- mm_segment_t old_fs = get_fs();
850850 u16 c, *cp;
851851 unsigned long addr;
852852 int i;
....@@ -916,13 +916,12 @@
916916 default:
917917 pr_cont("\n");
918918 }
919
- show_stack(NULL, (unsigned long *)addr);
919
+ show_stack(NULL, (unsigned long *)addr, KERN_INFO);
920920
921921 pr_info("Code:");
922
- set_fs(KERNEL_DS);
923922 cp = (u16 *)regs->pc;
924923 for (i = -8; i < 16; i++) {
925
- if (get_user(c, cp + i) && i >= 0) {
924
+ if (get_kernel_nofault(c, cp + i) && i >= 0) {
926925 pr_cont(" Bad PC value.");
927926 break;
928927 }
....@@ -931,11 +930,11 @@
931930 else
932931 pr_cont(" <%04x>", c);
933932 }
934
- set_fs(old_fs);
935933 pr_cont("\n");
936934 }
937935
938
-void show_stack(struct task_struct *task, unsigned long *stack)
936
+void show_stack(struct task_struct *task, unsigned long *stack,
937
+ const char *loglvl)
939938 {
940939 unsigned long *p;
941940 unsigned long *endstack;
....@@ -949,7 +948,7 @@
949948 }
950949 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
951950
952
- pr_info("Stack from %08lx:", (unsigned long)stack);
951
+ printk("%sStack from %08lx:", loglvl, (unsigned long)stack);
953952 p = stack;
954953 for (i = 0; i < kstack_depth_to_print; i++) {
955954 if (p + 1 > endstack)
....@@ -959,7 +958,7 @@
959958 pr_cont(" %08lx", *p++);
960959 }
961960 pr_cont("\n");
962
- show_trace(stack);
961
+ show_trace(stack, loglvl);
963962 }
964963
965964 /*
....@@ -1127,7 +1126,7 @@
11271126 addr = (void __user*) fp->un.fmtb.daddr;
11281127 break;
11291128 }
1130
- force_sig_fault(sig, si_code, addr, current);
1129
+ force_sig_fault(sig, si_code, addr);
11311130 }
11321131
11331132 void die_if_kernel (char *str, struct pt_regs *fp, int nr)
....@@ -1139,7 +1138,7 @@
11391138 pr_crit("%s: %08x\n", str, nr);
11401139 show_registers(fp);
11411140 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
1142
- do_exit(SIGSEGV);
1141
+ make_task_dead(SIGSEGV);
11431142 }
11441143
11451144 asmlinkage void set_esp0(unsigned long ssp)
....@@ -1159,6 +1158,6 @@
11591158 #ifdef CONFIG_M68KFPU_EMU
11601159 asmlinkage void fpemu_signal(int signal, int code, void *addr)
11611160 {
1162
- force_sig_fault(signal, code, addr, current);
1161
+ force_sig_fault(signal, code, addr);
11631162 }
11641163 #endif