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

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

 



Following commit in kernel v4.5 changed struct module, which affects offset
calculation of core 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 above kernel modification.

Signed-off-by: Pratyush Anand <panand at redhat.com>
---
 makedumpfile.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/makedumpfile.c b/makedumpfile.c
index 94c969c16ccc..12227ea1fbd8 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -1669,7 +1669,25 @@ get_structure_info(void)
 	OFFSET_INIT(module.list, "module", "list");
 	OFFSET_INIT(module.name, "module", "name");
 	OFFSET_INIT(module.module_core, "module", "module_core");
+	if (OFFSET(module.module_core) == NOT_FOUND_STRUCTURE) {
+		/* for kernel version 4.5 and above */
+		long core_layout;
+
+		OFFSET_INIT(module.module_core, "module", "core_layout");
+		core_layout = OFFSET(module.module_core);
+		OFFSET_INIT(module.module_core, "module_layout", "base");
+		OFFSET(module.module_core) += core_layout;
+	}
 	OFFSET_INIT(module.core_size, "module", "core_size");
+	if (OFFSET(module.core_size) == NOT_FOUND_STRUCTURE) {
+		/* for kernel version 4.5 and above */
+		long core_layout;
+
+		OFFSET_INIT(module.core_size, "module", "core_layout");
+		core_layout = OFFSET(module.core_size);
+		OFFSET_INIT(module.core_size, "module_layout", "size");
+		OFFSET(module.core_size) += core_layout;
+	}
 	OFFSET_INIT(module.module_init, "module", "module_init");
 	OFFSET_INIT(module.init_size, "module", "init_size");
 
-- 
2.5.0




[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