hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/sparc/kernel/traps_64.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* arch/sparc64/kernel/traps.c
23 *
34 * Copyright (C) 1995,1997,2008,2009,2012 David S. Miller (davem@davemloft.net)
....@@ -17,6 +18,7 @@
1718 #include <linux/smp.h>
1819 #include <linux/mm.h>
1920 #include <linux/init.h>
21
+#include <linux/kallsyms.h>
2022 #include <linux/kdebug.h>
2123 #include <linux/ftrace.h>
2224 #include <linux/reboot.h>
....@@ -28,7 +30,6 @@
2830 #include <asm/ptrace.h>
2931 #include <asm/oplib.h>
3032 #include <asm/page.h>
31
-#include <asm/pgtable.h>
3233 #include <asm/unistd.h>
3334 #include <linux/uaccess.h>
3435 #include <asm/fpumacro.h>
....@@ -107,7 +108,7 @@
107108 regs->tnpc &= 0xffffffff;
108109 }
109110 force_sig_fault(SIGILL, ILL_ILLTRP,
110
- (void __user *)regs->tpc, lvl, current);
111
+ (void __user *)regs->tpc, lvl);
111112 }
112113
113114 void bad_trap_tl1(struct pt_regs *regs, long lvl)
....@@ -201,7 +202,7 @@
201202 regs->tnpc &= 0xffffffff;
202203 }
203204 force_sig_fault(SIGSEGV, SEGV_MAPERR,
204
- (void __user *)regs->tpc, 0, current);
205
+ (void __user *)regs->tpc, 0);
205206 out:
206207 exception_exit(prev_state);
207208 }
....@@ -236,7 +237,7 @@
236237 regs->tpc &= 0xffffffff;
237238 regs->tnpc &= 0xffffffff;
238239 }
239
- force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0, current);
240
+ force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0);
240241 }
241242
242243 void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx)
....@@ -320,7 +321,7 @@
320321 if (is_no_fault_exception(regs))
321322 return;
322323
323
- force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0, current);
324
+ force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0);
324325 out:
325326 exception_exit(prev_state);
326327 }
....@@ -384,16 +385,13 @@
384385 */
385386 switch (type) {
386387 case HV_FAULT_TYPE_INV_ASI:
387
- force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0,
388
- current);
388
+ force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0);
389389 break;
390390 case HV_FAULT_TYPE_MCD_DIS:
391
- force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0,
392
- current);
391
+ force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0);
393392 break;
394393 default:
395
- force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0,
396
- current);
394
+ force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0);
397395 break;
398396 }
399397 }
....@@ -570,7 +568,7 @@
570568 regs->tpc &= 0xffffffff;
571569 regs->tnpc &= 0xffffffff;
572570 }
573
- force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0, current);
571
+ force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0);
574572 }
575573
576574 void spitfire_access_error(struct pt_regs *regs, unsigned long status_encoded, unsigned long afar)
....@@ -2072,7 +2070,7 @@
20722070 * code
20732071 */
20742072 force_sig_fault(SIGSEGV, SEGV_ADIDERR, (void __user *)ent.err_raddr,
2075
- 0, current);
2073
+ 0);
20762074 }
20772075
20782076 /* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
....@@ -2180,13 +2178,13 @@
21802178 addr += PAGE_SIZE;
21812179 }
21822180 }
2183
- force_sig(SIGKILL, current);
2181
+ force_sig(SIGKILL);
21842182
21852183 return true;
21862184 }
21872185 if (attrs & SUN4V_ERR_ATTRS_PIO) {
21882186 force_sig_fault(SIGBUS, BUS_ADRERR,
2189
- (void __user *)sun4v_get_vaddr(regs), 0, current);
2187
+ (void __user *)sun4v_get_vaddr(regs), 0);
21902188 return true;
21912189 }
21922190
....@@ -2343,7 +2341,7 @@
23432341 code = FPE_FLTRES;
23442342 }
23452343 force_sig_fault(SIGFPE, code,
2346
- (void __user *)regs->tpc, 0, current);
2344
+ (void __user *)regs->tpc, 0);
23472345 }
23482346 }
23492347
....@@ -2398,7 +2396,7 @@
23982396 regs->tnpc &= 0xffffffff;
23992397 }
24002398 force_sig_fault(SIGEMT, EMT_TAGOVF,
2401
- (void __user *)regs->tpc, 0, current);
2399
+ (void __user *)regs->tpc, 0);
24022400 out:
24032401 exception_exit(prev_state);
24042402 }
....@@ -2418,7 +2416,7 @@
24182416 regs->tnpc &= 0xffffffff;
24192417 }
24202418 force_sig_fault(SIGFPE, FPE_INTDIV,
2421
- (void __user *)regs->tpc, 0, current);
2419
+ (void __user *)regs->tpc, 0);
24222420 out:
24232421 exception_exit(prev_state);
24242422 }
....@@ -2453,7 +2451,7 @@
24532451 printk("\n");
24542452 }
24552453
2456
-void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2454
+void show_stack(struct task_struct *tsk, unsigned long *_ksp, const char *loglvl)
24572455 {
24582456 unsigned long fp, ksp;
24592457 struct thread_info *tp;
....@@ -2477,7 +2475,7 @@
24772475
24782476 fp = ksp + STACK_BIAS;
24792477
2480
- printk("Call Trace:\n");
2478
+ printk("%sCall Trace:\n", loglvl);
24812479 do {
24822480 struct sparc_stackf *sf;
24832481 struct pt_regs *regs;
....@@ -2498,13 +2496,14 @@
24982496 fp = (unsigned long)sf->fp + STACK_BIAS;
24992497 }
25002498
2501
- printk(" [%016lx] %pS\n", pc, (void *) pc);
2499
+ print_ip_sym(loglvl, pc);
25022500 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
25032501 if ((pc + 8UL) == (unsigned long) &return_to_handler) {
2504
- int index = tsk->curr_ret_stack;
2505
- if (tsk->ret_stack && index >= graph) {
2506
- pc = tsk->ret_stack[index - graph].ret;
2507
- printk(" [%016lx] %pS\n", pc, (void *) pc);
2502
+ struct ftrace_ret_stack *ret_stack;
2503
+ ret_stack = ftrace_graph_get_ret_stack(tsk, graph);
2504
+ if (ret_stack) {
2505
+ pc = ret_stack->ret;
2506
+ print_ip_sym(loglvl, pc);
25082507 graph++;
25092508 }
25102509 }
....@@ -2565,9 +2564,7 @@
25652564 }
25662565 if (panic_on_oops)
25672566 panic("Fatal exception");
2568
- if (regs->tstate & TSTATE_PRIV)
2569
- do_exit(SIGKILL);
2570
- do_exit(SIGSEGV);
2567
+ make_task_dead((regs->tstate & TSTATE_PRIV)? SIGKILL : SIGSEGV);
25712568 }
25722569 EXPORT_SYMBOL(die_if_kernel);
25732570
....@@ -2613,7 +2610,7 @@
26132610 }
26142611 }
26152612 }
2616
- force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0, current);
2613
+ force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0);
26172614 out:
26182615 exception_exit(prev_state);
26192616 }
....@@ -2633,7 +2630,7 @@
26332630 if (is_no_fault_exception(regs))
26342631 return;
26352632
2636
- force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0, current);
2633
+ force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0);
26372634 out:
26382635 exception_exit(prev_state);
26392636 }
....@@ -2651,7 +2648,7 @@
26512648 if (is_no_fault_exception(regs))
26522649 return;
26532650
2654
- force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0, current);
2651
+ force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0);
26552652 }
26562653
26572654 /* sun4v_mem_corrupt_detect_precise() - Handle precise exception on an ADI
....@@ -2698,7 +2695,7 @@
26982695 regs->tpc &= 0xffffffff;
26992696 regs->tnpc &= 0xffffffff;
27002697 }
2701
- force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0, current);
2698
+ force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0);
27022699 }
27032700
27042701 void do_privop(struct pt_regs *regs)
....@@ -2714,7 +2711,7 @@
27142711 regs->tnpc &= 0xffffffff;
27152712 }
27162713 force_sig_fault(SIGILL, ILL_PRVOPC,
2717
- (void __user *)regs->tpc, 0, current);
2714
+ (void __user *)regs->tpc, 0);
27182715 out:
27192716 exception_exit(prev_state);
27202717 }