[PATCH] makedumpfile: fix module init base and size offset for kernel v4.5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

This is a follow-up patch on the patch provided in post:

"[PATCH] makedumpfile: fix module core base and size offset for kernel v4.5"
by Pratyush Anand

What is missing there is the changes that were done to the module_init entry
of the struct module. The patch does basically the same as the patch for
module_core adapted to module_init.
Here is the patch:
---
Following commit in kernel v4.5 changed struct module, which affects offset
calculation of core and init layout's base and size.

commit 7523e4dc5057e157212b4741abd6256e03404cf1
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Nov 26 09:44:08 2015 +1030

    module: use a structure to encapsulate layout.

This patch fixes makedumpfile code to cater the module_init modification.

Signed-off-by: Guenther Hutzl <hutzl at linux.vnet.ibm.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.6.6

-- 
Guenther Hutzl
Linux on System z & Virtualization Development




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux