| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* arch/sparc64/kernel/traps.c |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 1995,1997,2008,2009,2012 David S. Miller (davem@davemloft.net) |
|---|
| .. | .. |
|---|
| 17 | 18 | #include <linux/smp.h> |
|---|
| 18 | 19 | #include <linux/mm.h> |
|---|
| 19 | 20 | #include <linux/init.h> |
|---|
| 21 | +#include <linux/kallsyms.h> |
|---|
| 20 | 22 | #include <linux/kdebug.h> |
|---|
| 21 | 23 | #include <linux/ftrace.h> |
|---|
| 22 | 24 | #include <linux/reboot.h> |
|---|
| .. | .. |
|---|
| 28 | 30 | #include <asm/ptrace.h> |
|---|
| 29 | 31 | #include <asm/oplib.h> |
|---|
| 30 | 32 | #include <asm/page.h> |
|---|
| 31 | | -#include <asm/pgtable.h> |
|---|
| 32 | 33 | #include <asm/unistd.h> |
|---|
| 33 | 34 | #include <linux/uaccess.h> |
|---|
| 34 | 35 | #include <asm/fpumacro.h> |
|---|
| .. | .. |
|---|
| 107 | 108 | regs->tnpc &= 0xffffffff; |
|---|
| 108 | 109 | } |
|---|
| 109 | 110 | force_sig_fault(SIGILL, ILL_ILLTRP, |
|---|
| 110 | | - (void __user *)regs->tpc, lvl, current); |
|---|
| 111 | + (void __user *)regs->tpc, lvl); |
|---|
| 111 | 112 | } |
|---|
| 112 | 113 | |
|---|
| 113 | 114 | void bad_trap_tl1(struct pt_regs *regs, long lvl) |
|---|
| .. | .. |
|---|
| 201 | 202 | regs->tnpc &= 0xffffffff; |
|---|
| 202 | 203 | } |
|---|
| 203 | 204 | force_sig_fault(SIGSEGV, SEGV_MAPERR, |
|---|
| 204 | | - (void __user *)regs->tpc, 0, current); |
|---|
| 205 | + (void __user *)regs->tpc, 0); |
|---|
| 205 | 206 | out: |
|---|
| 206 | 207 | exception_exit(prev_state); |
|---|
| 207 | 208 | } |
|---|
| .. | .. |
|---|
| 236 | 237 | regs->tpc &= 0xffffffff; |
|---|
| 237 | 238 | regs->tnpc &= 0xffffffff; |
|---|
| 238 | 239 | } |
|---|
| 239 | | - force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0, current); |
|---|
| 240 | + force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0); |
|---|
| 240 | 241 | } |
|---|
| 241 | 242 | |
|---|
| 242 | 243 | void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx) |
|---|
| .. | .. |
|---|
| 320 | 321 | if (is_no_fault_exception(regs)) |
|---|
| 321 | 322 | return; |
|---|
| 322 | 323 | |
|---|
| 323 | | - force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0, current); |
|---|
| 324 | + force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0); |
|---|
| 324 | 325 | out: |
|---|
| 325 | 326 | exception_exit(prev_state); |
|---|
| 326 | 327 | } |
|---|
| .. | .. |
|---|
| 384 | 385 | */ |
|---|
| 385 | 386 | switch (type) { |
|---|
| 386 | 387 | 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); |
|---|
| 389 | 389 | break; |
|---|
| 390 | 390 | 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); |
|---|
| 393 | 392 | break; |
|---|
| 394 | 393 | 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); |
|---|
| 397 | 395 | break; |
|---|
| 398 | 396 | } |
|---|
| 399 | 397 | } |
|---|
| .. | .. |
|---|
| 570 | 568 | regs->tpc &= 0xffffffff; |
|---|
| 571 | 569 | regs->tnpc &= 0xffffffff; |
|---|
| 572 | 570 | } |
|---|
| 573 | | - force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0, current); |
|---|
| 571 | + force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0); |
|---|
| 574 | 572 | } |
|---|
| 575 | 573 | |
|---|
| 576 | 574 | void spitfire_access_error(struct pt_regs *regs, unsigned long status_encoded, unsigned long afar) |
|---|
| .. | .. |
|---|
| 2072 | 2070 | * code |
|---|
| 2073 | 2071 | */ |
|---|
| 2074 | 2072 | force_sig_fault(SIGSEGV, SEGV_ADIDERR, (void __user *)ent.err_raddr, |
|---|
| 2075 | | - 0, current); |
|---|
| 2073 | + 0); |
|---|
| 2076 | 2074 | } |
|---|
| 2077 | 2075 | |
|---|
| 2078 | 2076 | /* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate. |
|---|
| .. | .. |
|---|
| 2180 | 2178 | addr += PAGE_SIZE; |
|---|
| 2181 | 2179 | } |
|---|
| 2182 | 2180 | } |
|---|
| 2183 | | - force_sig(SIGKILL, current); |
|---|
| 2181 | + force_sig(SIGKILL); |
|---|
| 2184 | 2182 | |
|---|
| 2185 | 2183 | return true; |
|---|
| 2186 | 2184 | } |
|---|
| 2187 | 2185 | if (attrs & SUN4V_ERR_ATTRS_PIO) { |
|---|
| 2188 | 2186 | force_sig_fault(SIGBUS, BUS_ADRERR, |
|---|
| 2189 | | - (void __user *)sun4v_get_vaddr(regs), 0, current); |
|---|
| 2187 | + (void __user *)sun4v_get_vaddr(regs), 0); |
|---|
| 2190 | 2188 | return true; |
|---|
| 2191 | 2189 | } |
|---|
| 2192 | 2190 | |
|---|
| .. | .. |
|---|
| 2343 | 2341 | code = FPE_FLTRES; |
|---|
| 2344 | 2342 | } |
|---|
| 2345 | 2343 | force_sig_fault(SIGFPE, code, |
|---|
| 2346 | | - (void __user *)regs->tpc, 0, current); |
|---|
| 2344 | + (void __user *)regs->tpc, 0); |
|---|
| 2347 | 2345 | } |
|---|
| 2348 | 2346 | } |
|---|
| 2349 | 2347 | |
|---|
| .. | .. |
|---|
| 2398 | 2396 | regs->tnpc &= 0xffffffff; |
|---|
| 2399 | 2397 | } |
|---|
| 2400 | 2398 | force_sig_fault(SIGEMT, EMT_TAGOVF, |
|---|
| 2401 | | - (void __user *)regs->tpc, 0, current); |
|---|
| 2399 | + (void __user *)regs->tpc, 0); |
|---|
| 2402 | 2400 | out: |
|---|
| 2403 | 2401 | exception_exit(prev_state); |
|---|
| 2404 | 2402 | } |
|---|
| .. | .. |
|---|
| 2418 | 2416 | regs->tnpc &= 0xffffffff; |
|---|
| 2419 | 2417 | } |
|---|
| 2420 | 2418 | force_sig_fault(SIGFPE, FPE_INTDIV, |
|---|
| 2421 | | - (void __user *)regs->tpc, 0, current); |
|---|
| 2419 | + (void __user *)regs->tpc, 0); |
|---|
| 2422 | 2420 | out: |
|---|
| 2423 | 2421 | exception_exit(prev_state); |
|---|
| 2424 | 2422 | } |
|---|
| .. | .. |
|---|
| 2453 | 2451 | printk("\n"); |
|---|
| 2454 | 2452 | } |
|---|
| 2455 | 2453 | |
|---|
| 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) |
|---|
| 2457 | 2455 | { |
|---|
| 2458 | 2456 | unsigned long fp, ksp; |
|---|
| 2459 | 2457 | struct thread_info *tp; |
|---|
| .. | .. |
|---|
| 2477 | 2475 | |
|---|
| 2478 | 2476 | fp = ksp + STACK_BIAS; |
|---|
| 2479 | 2477 | |
|---|
| 2480 | | - printk("Call Trace:\n"); |
|---|
| 2478 | + printk("%sCall Trace:\n", loglvl); |
|---|
| 2481 | 2479 | do { |
|---|
| 2482 | 2480 | struct sparc_stackf *sf; |
|---|
| 2483 | 2481 | struct pt_regs *regs; |
|---|
| .. | .. |
|---|
| 2498 | 2496 | fp = (unsigned long)sf->fp + STACK_BIAS; |
|---|
| 2499 | 2497 | } |
|---|
| 2500 | 2498 | |
|---|
| 2501 | | - printk(" [%016lx] %pS\n", pc, (void *) pc); |
|---|
| 2499 | + print_ip_sym(loglvl, pc); |
|---|
| 2502 | 2500 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
|---|
| 2503 | 2501 | 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); |
|---|
| 2508 | 2507 | graph++; |
|---|
| 2509 | 2508 | } |
|---|
| 2510 | 2509 | } |
|---|
| .. | .. |
|---|
| 2613 | 2612 | } |
|---|
| 2614 | 2613 | } |
|---|
| 2615 | 2614 | } |
|---|
| 2616 | | - force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0, current); |
|---|
| 2615 | + force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0); |
|---|
| 2617 | 2616 | out: |
|---|
| 2618 | 2617 | exception_exit(prev_state); |
|---|
| 2619 | 2618 | } |
|---|
| .. | .. |
|---|
| 2633 | 2632 | if (is_no_fault_exception(regs)) |
|---|
| 2634 | 2633 | return; |
|---|
| 2635 | 2634 | |
|---|
| 2636 | | - force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0, current); |
|---|
| 2635 | + force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0); |
|---|
| 2637 | 2636 | out: |
|---|
| 2638 | 2637 | exception_exit(prev_state); |
|---|
| 2639 | 2638 | } |
|---|
| .. | .. |
|---|
| 2651 | 2650 | if (is_no_fault_exception(regs)) |
|---|
| 2652 | 2651 | return; |
|---|
| 2653 | 2652 | |
|---|
| 2654 | | - force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0, current); |
|---|
| 2653 | + force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0); |
|---|
| 2655 | 2654 | } |
|---|
| 2656 | 2655 | |
|---|
| 2657 | 2656 | /* sun4v_mem_corrupt_detect_precise() - Handle precise exception on an ADI |
|---|
| .. | .. |
|---|
| 2698 | 2697 | regs->tpc &= 0xffffffff; |
|---|
| 2699 | 2698 | regs->tnpc &= 0xffffffff; |
|---|
| 2700 | 2699 | } |
|---|
| 2701 | | - force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0, current); |
|---|
| 2700 | + force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0); |
|---|
| 2702 | 2701 | } |
|---|
| 2703 | 2702 | |
|---|
| 2704 | 2703 | void do_privop(struct pt_regs *regs) |
|---|
| .. | .. |
|---|
| 2714 | 2713 | regs->tnpc &= 0xffffffff; |
|---|
| 2715 | 2714 | } |
|---|
| 2716 | 2715 | force_sig_fault(SIGILL, ILL_PRVOPC, |
|---|
| 2717 | | - (void __user *)regs->tpc, 0, current); |
|---|
| 2716 | + (void __user *)regs->tpc, 0); |
|---|
| 2718 | 2717 | out: |
|---|
| 2719 | 2718 | exception_exit(prev_state); |
|---|
| 2720 | 2719 | } |
|---|