[PATCH] Fix module module_init/init_size offsets for v4.5 kernel

Kamalesh Babulal kamalesh at linux.vnet.ibm.com
Thu Oct 27 22:07:14 PDT 2016


Kernel commit 7523e4dc50 (module: use a structure to encapsulate layout.)
encapsulates core_layout and init_layout into module_layout structure.

commit fa6a75a93 (Fix module core base and size offset for kernel v4.5)
fixes offset value calculation for core layout's base and size, whereas
Kernel v4.5 module changes also needs fixing of module init_size and
module_init for the makedumpfile to read the correct module address.

This patch fixes calculation of offsets values for module init_size and
module_init.

Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
Cc: Pratyush Anand <panand at redhat.com>
---
 makedumpfile.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/makedumpfile.c b/makedumpfile.c
index 853b999..f33a90d 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -1689,7 +1689,25 @@ get_structure_info(void)
 		OFFSET(module.core_size) += core_layout;
 	}
 	OFFSET_INIT(module.module_init, "module", "module_init");
+	if (OFFSET(module.module_init) == NOT_FOUND_STRUCTURE) {
+		/* for kernel version 4.5 and above */
+		long init_layout;
+
+		OFFSET_INIT(module.module_init, "module", "init_layout");
+		init_layout = OFFSET(module.module_init);
+		OFFSET_INIT(module.module_init, "module_layout", "base");
+		OFFSET(module.module_init) += init_layout;
+	}
 	OFFSET_INIT(module.init_size, "module", "init_size");
+	if (OFFSET(module.init_size) == NOT_FOUND_STRUCTURE) {
+		/* for kernel version 4.5 and above */
+		long init_layout;
+
+		OFFSET_INIT(module.init_size, "module", "init_layout");
+		init_layout = OFFSET(module.init_size);
+		OFFSET_INIT(module.init_size, "module_layout", "size");
+		OFFSET(module.init_size) += init_layout;
+	}
 
 	ENUM_NUMBER_INIT(NR_FREE_PAGES, "NR_FREE_PAGES");
 	ENUM_NUMBER_INIT(N_ONLINE, "N_ONLINE");
-- 
2.7.4




More information about the kexec mailing list