Calculate offset to field 'init_uts_ns.name'
Subsystems (2)
PATCH 1/1 Calculate offset to field 'init_uts_ns.name'
The offset has changed in linux-next (v5.9.0) from 4 to 0 because there is no more 'kref' member variable at the beginning of 'init_uts_ns'. The change was introduced with commit 9a56493f6942c0e2df1579986128721da96e00d8. To handle both cases correctly, calculate the offset at run time instead.
--- makedumpfile.c | 6 ++++-- makedumpfile.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-)
makedumpfile.c +4 -2
@@ -1159,7 +1159,7 @@ check_release(void)if (SYMBOL (system_utsname) !=NOT_FOUND_SYMBOL ) { utsname =SYMBOL (system_utsname); }else if (SYMBOL (init_uts_ns) !=NOT_FOUND_SYMBOL ) { - utsname =SYMBOL (init_uts_ns) +sizeof (int ); + utsname =SYMBOL (init_uts_ns) +OFFSET (init_uts_ns.name); }else {ERRMSG ("Can't get the symbol of system_utsname.\n" );return FALSE;
@@ -2077,7 +2077,7 @@ get_str_osrelease_from_vmlinux(void)if (SYMBOL (system_utsname) !=NOT_FOUND_SYMBOL ) { utsname =SYMBOL (system_utsname); }else if (SYMBOL (init_uts_ns) !=NOT_FOUND_SYMBOL ) { - utsname =SYMBOL (init_uts_ns) +sizeof (int ); + utsname =SYMBOL (init_uts_ns) +OFFSET (init_uts_ns.name); }else {ERRMSG ("Can't get the symbol of system_utsname.\n" );return FALSE;
@@ -2697,6 +2697,8 @@ read_vmcoreinfo(void)READ_MEMBER_OFFSET ("log.text_len" , printk_log.text_len); } +READ_MEMBER_OFFSET ("init_uts_ns.name" , init_uts_ns.name); +READ_ARRAY_LENGTH ("node_data" , node_data);READ_ARRAY_LENGTH ("pgdat_list" , pgdat_list);READ_ARRAY_LENGTH ("mem_section" , mem_section);
makedumpfile.h +4 -0
@@ -1880,6 +1880,10 @@ struct offset_table {struct cpu_spec_s {long mmu_features; } cpu_spec; + +struct init_uts_ns_s { +long name; + } init_uts_ns; };/*
Signature · 7 lines
2.26.2 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Hi Alexander,
Thanks for the patch. See some nitpicks inline:
Quoted 17 lines · Alexander Egorenkov
The offset has changed in linux-next (v5.9.0) from 4 to 0 because there is no more 'kref' member variable at the beginning of '
init_uts_ns'. The change was introduced with commit9a56493f6942c0e2df1579986128721da96e00d8. To handle both cases correctly, calculate the offset at run time instead.Signed-off-by Alexander Egorenkov <[email protected]>--- makedumpfile.c | 6 ++++-- makedumpfile.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-)makedumpfile.c +0
-0
makedumpfile.c check_release(void) · line 1162
Quoted 5 lines
makedumpfile.c +1
-1@@ -1159,7 +1159,7 @@ check_release(void)if (SYMBOL (system_utsname) !=NOT_FOUND_SYMBOL ) { utsname =SYMBOL (system_utsname); }else if (SYMBOL (init_uts_ns) !=NOT_FOUND_SYMBOL ) { - utsname =SYMBOL (init_uts_ns) +sizeof (int ); + utsname =SYMBOL (init_uts_ns) +OFFSET (init_uts_ns.name);
I am not sure if it is an issue with my mail-client or if the indentation is a bit different from the original code (I see a additional space before the statement) [and likewise below].
Please fix those..
Quoted 13 lines
makedumpfile.c +1
-1}else {ERRMSG ("Can't get the symbol of system_utsname.\n" );return FALSE;@@ -2077,7 +2077,7 @@ get_str_osrelease_from_vmlinux(void)if (SYMBOL (system_utsname) !=NOT_FOUND_SYMBOL ) { utsname =SYMBOL (system_utsname); }else if (SYMBOL (init_uts_ns) !=NOT_FOUND_SYMBOL ) { - utsname =SYMBOL (init_uts_ns) +sizeof (int ); + utsname =SYMBOL (init_uts_ns) +OFFSET (init_uts_ns.name); }else {ERRMSG ("Can't get the symbol of system_utsname.\n" );return FALSE;
makedumpfile.c read_vmcoreinfo(void) · line 2704
Quoted 8 lines
makedumpfile.c +2
-0@@ -2697,6 +2697,8 @@ read_vmcoreinfo(void)READ_MEMBER_OFFSET ("log.text_len" , printk_log.text_len); } +READ_MEMBER_OFFSET ("init_uts_ns.name" , init_uts_ns.name); +READ_ARRAY_LENGTH ("node_data" , node_data);READ_ARRAY_LENGTH ("pgdat_list" , pgdat_list);READ_ARRAY_LENGTH ("mem_section" , mem_section);
Hmm.. don't we need a similar addition inside 'write_vmcoreinfo_data'. Something like:WRITE_MEMBER_OFFSET("init_uts_ns.name", init_uts_ns.name);
Quoted 16 lines
makedumpfile.h +4
-1@@ -1880,6 +1880,10 @@ struct offset_table {struct cpu_spec_s {long mmu_features; } cpu_spec; + +struct init_uts_ns_s { +long name; + } init_uts_ns; };/* --
Quoted 1 line
2.26.2
Thanks,
Bhupesh
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 5 lines · Bhupesh SHARMA
I am not sure if it is an issue with my mail-client or if the indentation is a bit different from the original code (I see a additional space before the statement) [and likewise below].
Please fix those..
Sorry, i do not see any spaces in my diffs, only tabs.
Quoted 4 lines
Hmm.. don't we need a similar addition inside '
write_vmcoreinfo_data'. Something like:WRITE_MEMBER_OFFSET("init_uts_ns.name", init_uts_ns.name);
Fixed. Sorry. My first makedumpfile change, still new ;)
Regards
Alex
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec