@@ -28,6 +28,8 @@ int panic_on_unrecovered_nmi;
28
28
int panic_on_io_nmi ;
29
29
static int die_counter ;
30
30
31
+ static struct pt_regs exec_summary_regs ;
32
+
31
33
bool in_task_stack (unsigned long * stack , struct task_struct * task ,
32
34
struct stack_info * info )
33
35
{
@@ -321,6 +323,9 @@ void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
321
323
raw_local_irq_restore (flags );
322
324
oops_exit ();
323
325
326
+ /* Executive summary in case the oops scrolled away */
327
+ __show_regs (& exec_summary_regs , true);
328
+
324
329
if (!signr )
325
330
return ;
326
331
if (in_interrupt ())
@@ -339,10 +344,10 @@ NOKPROBE_SYMBOL(oops_end);
339
344
340
345
int __die (const char * str , struct pt_regs * regs , long err )
341
346
{
342
- #ifdef CONFIG_X86_32
343
- unsigned short ss ;
344
- unsigned long sp ;
345
- #endif
347
+ /* Save the regs of the first oops for the executive summary later. */
348
+ if (! die_counter )
349
+ exec_summary_regs = * regs ;
350
+
346
351
printk (KERN_DEFAULT
347
352
"%s: %04lx [#%d]%s%s%s%s%s\n" , str , err & 0xffff , ++ die_counter ,
348
353
IS_ENABLED (CONFIG_PREEMPT ) ? " PREEMPT" : "" ,
@@ -352,26 +357,13 @@ int __die(const char *str, struct pt_regs *regs, long err)
352
357
IS_ENABLED (CONFIG_PAGE_TABLE_ISOLATION ) ?
353
358
(boot_cpu_has (X86_FEATURE_PTI ) ? " PTI" : " NOPTI" ) : "" );
354
359
360
+ show_regs (regs );
361
+ print_modules ();
362
+
355
363
if (notify_die (DIE_OOPS , str , regs , err ,
356
364
current -> thread .trap_nr , SIGSEGV ) == NOTIFY_STOP )
357
365
return 1 ;
358
366
359
- print_modules ();
360
- show_regs (regs );
361
- #ifdef CONFIG_X86_32
362
- if (user_mode (regs )) {
363
- sp = regs -> sp ;
364
- ss = regs -> ss ;
365
- } else {
366
- sp = kernel_stack_pointer (regs );
367
- savesegment (ss , ss );
368
- }
369
- printk (KERN_EMERG "EIP: %pS SS:ESP: %04x:%08lx\n" ,
370
- (void * )regs -> ip , ss , sp );
371
- #else
372
- /* Executive summary in case the oops scrolled away */
373
- printk (KERN_ALERT "RIP: %pS RSP: %016lx\n" , (void * )regs -> ip , regs -> sp );
374
- #endif
375
367
return 0 ;
376
368
}
377
369
NOKPROBE_SYMBOL (__die );
0 commit comments