@@ -99,27 +99,31 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
9999int kstack_depth_to_print = 12 ;
100100
101101#ifdef CONFIG_KALLSYMS
102- void printk_address (unsigned long address )
102+ void printk_address (unsigned long address , int reliable )
103103{
104104 unsigned long offset = 0 , symsize ;
105105 const char * symname ;
106106 char * modname ;
107107 char * delim = ":" ;
108108 char namebuf [128 ];
109+ char reliab [4 ] = "" ;;
109110
110111 symname = kallsyms_lookup (address , & symsize , & offset ,
111112 & modname , namebuf );
112113 if (!symname ) {
113114 printk (" [<%016lx>]\n" , address );
114115 return ;
115116 }
117+ if (!reliable )
118+ strcpy (reliab , "? " );
119+
116120 if (!modname )
117121 modname = delim = "" ;
118- printk (" [<%016lx>] %s%s%s%s+0x%lx/0x%lx\n" ,
119- address , delim , modname , delim , symname , offset , symsize );
122+ printk (" [<%016lx>] %s%s%s%s%s +0x%lx/0x%lx\n" ,
123+ address , reliab , delim , modname , delim , symname , offset , symsize );
120124}
121125#else
122- void printk_address (unsigned long address )
126+ void printk_address (unsigned long address , int reliable )
123127{
124128 printk (" [<%016lx>]\n" , address );
125129}
@@ -215,7 +219,7 @@ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
215219}
216220
217221void dump_trace (struct task_struct * tsk , struct pt_regs * regs ,
218- unsigned long * stack ,
222+ unsigned long * stack , unsigned long bp ,
219223 const struct stacktrace_ops * ops , void * data )
220224{
221225 const unsigned cpu = get_cpu ();
@@ -252,7 +256,7 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
252256 * down the cause of the crash will be able to figure \
253257 * out the call path that was taken. \
254258 */ \
255- ops -> address (data , addr ); \
259+ ops -> address (data , addr , 1 ); \
256260 } \
257261 } while (0 )
258262
@@ -331,10 +335,10 @@ static int print_trace_stack(void *data, char *name)
331335 return 0 ;
332336}
333337
334- static void print_trace_address (void * data , unsigned long addr )
338+ static void print_trace_address (void * data , unsigned long addr , int reliable )
335339{
336340 touch_nmi_watchdog ();
337- printk_address (addr );
341+ printk_address (addr , reliable );
338342}
339343
340344static const struct stacktrace_ops print_trace_ops = {
@@ -345,15 +349,17 @@ static const struct stacktrace_ops print_trace_ops = {
345349};
346350
347351void
348- show_trace (struct task_struct * tsk , struct pt_regs * regs , unsigned long * stack )
352+ show_trace (struct task_struct * tsk , struct pt_regs * regs , unsigned long * stack ,
353+ unsigned long bp )
349354{
350355 printk ("\nCall Trace:\n" );
351- dump_trace (tsk , regs , stack , & print_trace_ops , NULL );
356+ dump_trace (tsk , regs , stack , bp , & print_trace_ops , NULL );
352357 printk ("\n" );
353358}
354359
355360static void
356- _show_stack (struct task_struct * tsk , struct pt_regs * regs , unsigned long * sp )
361+ _show_stack (struct task_struct * tsk , struct pt_regs * regs , unsigned long * sp ,
362+ unsigned long bp )
357363{
358364 unsigned long * stack ;
359365 int i ;
@@ -387,12 +393,12 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *sp)
387393 printk (" %016lx" , * stack ++ );
388394 touch_nmi_watchdog ();
389395 }
390- show_trace (tsk , regs , sp );
396+ show_trace (tsk , regs , sp , bp );
391397}
392398
393399void show_stack (struct task_struct * tsk , unsigned long * sp )
394400{
395- _show_stack (tsk , NULL , sp );
401+ _show_stack (tsk , NULL , sp , 0 );
396402}
397403
398404/*
@@ -401,13 +407,14 @@ void show_stack(struct task_struct *tsk, unsigned long * sp)
401407void dump_stack (void )
402408{
403409 unsigned long dummy ;
410+ unsigned long bp = 0 ;
404411
405412 printk ("Pid: %d, comm: %.20s %s %s %.*s\n" ,
406413 current -> pid , current -> comm , print_tainted (),
407414 init_utsname ()-> release ,
408415 (int )strcspn (init_utsname ()-> version , " " ),
409416 init_utsname ()-> version );
410- show_trace (NULL , NULL , & dummy );
417+ show_trace (NULL , NULL , & dummy , bp );
411418}
412419
413420EXPORT_SYMBOL (dump_stack );
@@ -432,7 +439,7 @@ void show_registers(struct pt_regs *regs)
432439 */
433440 if (in_kernel ) {
434441 printk ("Stack: " );
435- _show_stack (NULL , regs , (unsigned long * )sp );
442+ _show_stack (NULL , regs , (unsigned long * )sp , regs -> bp );
436443
437444 printk ("\nCode: " );
438445 if (regs -> ip < PAGE_OFFSET )
@@ -527,7 +534,7 @@ int __kprobes __die(const char * str, struct pt_regs * regs, long err)
527534 add_taint (TAINT_DIE );
528535 /* Executive summary in case the oops scrolled away */
529536 printk (KERN_ALERT "RIP " );
530- printk_address (regs -> ip );
537+ printk_address (regs -> ip , regs -> bp );
531538 printk (" RSP <%016lx>\n" , regs -> sp );
532539 if (kexec_should_crash (current ))
533540 crash_kexec (regs );
0 commit comments