[Crash-utility] [PATCH] Fix module init for initcall crash

Rabin Vincent rabin.vincent at axis.com
Sun Dec 4 14:16:36 UTC 2016


From: Rabin Vincent <rabinv at axis.com>

If the kernel crashed while running a module's initcall, then the
mod->init_size is not zero and in this case crash fails while gathering
module symbol data with:

 crash: store_module_symbols_v2: total: 7 mcnt: 8

This seems to be because store_module_symbols_v2 will add pseudo-symbols
for MODULE_INIT_START and MODULE_INIT_END, while the "total" calculation
in module_init() doesn't account for this.

For reference, a log with -d8:

 please wait... (gathering module symbol data)module: c00fc5c0
 <readmem: c00fc5c0, KVADDR, "module struct", 384, (ROE|Q), 8701800>
 <readmem: 80540000, KVADDR, "pgd page", 16384, (FOE), a0c3ec8>
 <read_ramdump: addr: 80540000 paddr: 540000 cnt: 16384>
 read_ramdump: addr: 80540000 paddr: 540000 cnt: 16384 offset: 540000
 <readmem: 72b0000, PHYSADDR, "page table", 16384, (FOE), a0c7ed0>
 <read_ramdump: addr: 72b0000 paddr: 72b0000 cnt: 16384>
 read_ramdump: addr: 0 paddr: 72b0000 cnt: 16384 offset: 72b0000
 <read_ramdump: addr: c00fc5c0 paddr: 722c5c0 cnt: 384>
 read_ramdump: addr: c00fc5c0 paddr: 722c5c0 cnt: 384 offset: 722c5c0
 FREEBUF(0)
 GETBUF(384 -> 0)
 <readmem: c00fc5c0, KVADDR, "module buffer", 384, (FOE), 8701800>
 <read_ramdump: addr: c00fc5c0 paddr: 722c5c0 cnt: 384>
 read_ramdump: addr: c00fc5c0 paddr: 722c5c0 cnt: 384 offset: 722c5c0
 c00fc5c0 (c00fc000): null_blk syms: 0 gplsyms: 0 ksyms: 5
   GETBUF(2031 -> 1)
 <readmem: c00fc000, KVADDR, "module (kallsyms)", 2031, (ROE|Q), 8704000>
 <read_ramdump: addr: c00fc000 paddr: 722c000 cnt: 2031>
 read_ramdump: addr: c00fc000 paddr: 722c000 cnt: 2031 offset: 722c000
     GETBUF(4140 -> 2)
 <readmem: c0104000, KVADDR, "module init (kallsyms)", 4140, (ROE|Q), 870e000>
 <read_ramdump: addr: c0104000 paddr: 7154000 cnt: 4140>
 read_ramdump: addr: c0104000 paddr: 7154000 cnt: 4140 offset: 7154000
 null_set_queue_mode: st_name: 1 st_value: c00fc000 st_shndx: 2 st_info: t
 null_set_irqmode: st_name: 21 st_value: c00fc048 st_shndx: 2 st_info: t
 null_exit: st_name: 38 st_value: c00fc090 st_shndx: 6 st_info: t
 cleanup_module: st_name: 48 st_value: c00fc090 st_shndx: 6 st_info: t
     FREEBUF(2)
   FREEBUF(1)
 FREEBUF(0)

 crash: store_module_symbols_v2: total: 7 mcnt: 8
---
 kernel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel.c b/kernel.c
index 9019cf5..bdd0d05 100644
--- a/kernel.c
+++ b/kernel.c
@@ -3475,6 +3475,7 @@ module_init(void)
 
 		total += nsyms;
 		total += 2;  /* store the module's start/ending addresses */
+		total += 2;  /* and the init start/ending addresses */
 
 		/*
 		 *  If the module has kallsyms, set up to grab them as well.
-- 
2.1.4




More information about the Crash-utility mailing list