Discussion:
[PATCH] Fix module module_init/init_size offsets for v4.5 kernel
Kamalesh Babulal
2016-10-28 05:07:14 UTC
Permalink
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 <***@linux.vnet.ibm.com>
Cc: Pratyush Anand <***@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
Pratyush Anand
2016-10-28 06:17:55 UTC
Permalink
Post by Kamalesh Babulal
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.
---
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");
Pratyush Anand
2016-10-28 06:18:10 UTC
Permalink
Post by Kamalesh Babulal
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.
---
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");
Atsushi Kumagai
2016-10-28 06:36:51 UTC
Permalink
Hello Kamalesh and Pratyush,
Post by Kamalesh Babulal
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.
Thanks, but I think Guenther posted the same fix which you can see
in the devel branch:

commit 32dd46803944959f78e01e7c4847c465efca99a6
Author: Guenther Hutzl <***@linux.vnet.ibm.com>
Date: Wed Jul 6 20:00:54 2016 +0900

[PATCH] Fix module init base and size offset for kernel v4.5

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


Thanks,
Atsushi Kumagai
Post by Kamalesh Babulal
---
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");
_______________________________________________
kexec mailing list
http://lists.infradead.org/mailman/listinfo/kexec
Kamalesh Babulal
2016-10-28 12:17:08 UTC
Permalink
Post by Atsushi Kumagai
Post by Kamalesh Babulal
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.
Thanks, but I think Guenther posted the same fix which you can see
commit 32dd46803944959f78e01e7c4847c465efca99a6
Date: Wed Jul 6 20:00:54 2016 +0900
[PATCH] Fix module init base and size offset for kernel v4.5
Thank you for pointing out the commit. Should I rebase future patch
against devel branch.

Thanks,
Kamalesh.
Atsushi Kumagai
2016-10-31 06:17:00 UTC
Permalink
Post by Kamalesh Babulal
Post by Atsushi Kumagai
Post by Kamalesh Babulal
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.
Thanks, but I think Guenther posted the same fix which you can see
commit 32dd46803944959f78e01e7c4847c465efca99a6
Date: Wed Jul 6 20:00:54 2016 +0900
[PATCH] Fix module init base and size offset for kernel v4.5
Thank you for pointing out the commit. Should I rebase future patch
against devel branch.
Yes, I recommend that. It's better also for me to review.

Thanks,
Atsushi Kumagai

Loading...