8 #include <linux/utsname.h>
11 #include <linux/module.h>
12 #include <linux/ptrace.h>
14 #include <linux/kexec.h>
19 #include <asm/stacktrace.h>
26 static int die_counter;
31 (
void *)address, reliable ?
"" :
"? ", (
void *)address);
34 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
36 print_ftrace_graph_addr(
unsigned long addr,
void *
data,
41 unsigned long ret_addr;
48 index = task->curr_ret_stack;
50 if (!task->ret_stack || index < *graph)
54 ret_addr = task->ret_stack[
index].ret;
56 ops->
address(data, ret_addr, 1);
62 print_ftrace_graph_addr(
unsigned long addr,
void *data,
75 static inline int valid_stack_ptr(
struct thread_info *tinfo,
76 void *
p,
unsigned int size,
void *
end)
90 unsigned long *
stack,
unsigned long bp,
92 unsigned long *end,
int *graph)
96 while (valid_stack_ptr(tinfo, stack,
sizeof(*stack), end)) {
101 if ((
unsigned long) stack == bp +
sizeof(
long)) {
104 bp = (
unsigned long) frame;
108 print_ftrace_graph_addr(addr, data, ops, tinfo, graph);
118 unsigned long *
stack,
unsigned long bp,
120 unsigned long *end,
int *graph)
125 while (valid_stack_ptr(tinfo, ret_addr,
sizeof(*ret_addr), end)) {
126 unsigned long addr = *ret_addr;
134 print_ftrace_graph_addr(addr, data, ops, tinfo, graph);
137 return (
unsigned long)
frame;
141 static int print_trace_stack(
void *data,
char *
name)
143 printk(
"%s <%s> ", (
char *)data, name);
150 static void print_trace_address(
void *data,
unsigned long addr,
int reliable)
158 .stack = print_trace_stack,
159 .address = print_trace_address,
165 unsigned long *
stack,
unsigned long bp,
char *log_lvl)
167 printk(
"%sCall Trace:\n", log_lvl);
168 dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl);
172 unsigned long *
stack,
unsigned long bp)
191 printk(
"Pid: %d, comm: %.20s %s %s %.*s\n",
201 static int die_owner = -1;
202 static unsigned int die_nest_count;
215 if (cpu == die_owner)
246 panic(
"Fatal exception in interrupt");
248 panic(
"Fatal exception");
259 "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
260 #ifdef CONFIG_PREEMPT
266 #ifdef CONFIG_DEBUG_PAGEALLOC
267 printk(
"DEBUG_PAGEALLOC");
277 if (user_mode_vm(regs)) {
279 ss = regs->
ss & 0xffff;
285 print_symbol(
"%s", regs->ip);
286 printk(
" SS:ESP %04x:%08lx\n", ss, sp);
291 printk(
" RSP <%016lx>\n", regs->
sp);
305 if (!user_mode_vm(regs))
308 if (
__die(str, regs, err))
313 static int __init kstack_setup(
char *
s)
321 ret = kstrtoul(s, 0, &val);
329 static int __init code_bytes_setup(
char *s)
337 ret = kstrtoul(s, 0, &val);
347 __setup(
"code_bytes=", code_bytes_setup);