File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 21
21
#include <linux/smp.h>
22
22
#include <linux/efi.h>
23
23
#include <linux/crash_dump.h>
24
+ #include <linux/panic_notifier.h>
24
25
25
26
#include <asm/acpi.h>
26
27
#include <asm/alternative.h>
@@ -341,3 +342,27 @@ void free_initmem(void)
341
342
342
343
free_initmem_default (POISON_FREE_INITMEM );
343
344
}
345
+
346
+ static int dump_kernel_offset (struct notifier_block * self ,
347
+ unsigned long v , void * p )
348
+ {
349
+ pr_emerg ("Kernel Offset: 0x%lx from 0x%lx\n" ,
350
+ kernel_map .virt_offset ,
351
+ KERNEL_LINK_ADDR );
352
+
353
+ return 0 ;
354
+ }
355
+
356
+ static struct notifier_block kernel_offset_notifier = {
357
+ .notifier_call = dump_kernel_offset
358
+ };
359
+
360
+ static int __init register_kernel_offset_dumper (void )
361
+ {
362
+ if (IS_ENABLED (CONFIG_RANDOMIZE_BASE ))
363
+ atomic_notifier_chain_register (& panic_notifier_list ,
364
+ & kernel_offset_notifier );
365
+
366
+ return 0 ;
367
+ }
368
+ device_initcall (register_kernel_offset_dumper );
You can’t perform that action at this time.
0 commit comments