Kconfig.debug: module: Add debug config to debug modules

There can be scenario where, dynamically loadable modules adds
a certain nodes in list data structure and forgot to remove
reference from the list while unloading themself. And this can
result in fault while accessing those dangling pointers.

So If we log the module used address ranges, we could be able to
tell exact victim module.

And, It will be good to keep these debug logs under a config flag.

So, let's add DEBUG_MODULE_LOAD_INFO config and use this in
printing module used init and core layout address
ranges.

e.g:
Core layout sections:
[   40.599573]  .text
[   40.627074]  .plt
[   40.603426]  .rodata.str1.8
[   40.608016]  __mcount_loc
[   40.622142]  .note.gnu.build-id
[   40.612654]  .data
[   40.616438]  .gnu.linkonce.this_module
[   40.634909]  .bss

Init layout sections
[   40.630781]  .init.plt
[   40.638591]  .symtab
[   40.642573]  .strtab

After this patch:
/ # insmod sample.ko
[   26.244768] Hi Mukesh
[   26.247314] Loaded sample: module init layout addresses range: 0xffffff9dbff8a000-0xffffff9dbff8bfff
[   26.256896] sample: core layout addresses range: 0xffffff9dbff85000-0xffffff9dbff88fff
/ # rmmod sample
[   63.812065] Bye Mukesh
[   63.816318] Unloaded sample: module core layout address range: 0xffffff9dbff85000-0xffffff9dbff88fff

Change-Id: I4acfc4f53c561f92ca63fa3c4559148929575580
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
diff --git a/kernel/module.c b/kernel/module.c
index 13ad2f8..8a84031 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2156,6 +2156,11 @@
 
 	/* Finally, free the core (containing the module structure) */
 	disable_ro_nx(&mod->core_layout);
+#ifdef CONFIG_DEBUG_MODULE_LOAD_INFO
+	pr_info("Unloaded %s: module core layout address range: 0x%lx-0x%lx\n",
+		mod->name, (long)mod->core_layout.base,
+		(long)(mod->core_layout.base + mod->core_layout.size - 1));
+#endif
 	module_memfree(mod->core_layout.base);
 
 #ifdef CONFIG_MPU
@@ -3469,6 +3474,14 @@
 	mod_tree_remove_init(mod);
 	disable_ro_nx(&mod->init_layout);
 	module_arch_freeing_init(mod);
+#ifdef CONFIG_DEBUG_MODULE_LOAD_INFO
+	pr_info("Loaded %s: module init layout addresses range: 0x%lx-0x%lx\n",
+		mod->name, (long)mod->init_layout.base,
+		(long)(mod->init_layout.base + mod->init_layout.size - 1));
+	pr_info("%s: core layout addresses range: 0x%lx-0x%lx\n", mod->name,
+		(long)mod->core_layout.base,
+		(long)(mod->core_layout.base + mod->core_layout.size - 1));
+#endif
 	mod->init_layout.base = NULL;
 	mod->init_layout.size = 0;
 	mod->init_layout.ro_size = 0;