Fix segmentation fault for makedumpfile -x/--split
Subsystems (2)
PATCH 1/1 Fix segmentation fault for makedumpfile -x/--split
The patch fixes the segmentation fault issue of makedumpfile when a user specifies an invalid file name with -x/--split option. The patch takes care of such a scenario by setting .find_debuginfo to a function pointer which returns -1 and throws error messages against invalid vmlinux file input. With a valid vmlinux file .find_debuginfo was never invoked since the absolute path of debuginfo was known by the time we call init_dwarf_info.
--- dwarf_info.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
dwarf_info.c +25 -0
@@ -204,6 +204,16 @@ search_module_debuginfo(char *os_release)return FALSE; } +static int +dwarf_no_debuginfo_found (Dwfl_Module *mod,void **userdata, +const char *modname,Dwarf_Addr base, +const char *file_name, +const char *debuglink_file,GElf_Word debuglink_crc, +char **debuginfo_file_name) +{ +return -1 ; +} +/* * Initialize the dwarf info. * Linux kernel module debuginfo are of ET_REL (relocatable) type.
@@ -219,6 +229,21 @@ init_dwarf_info(void)int dwfl_fd =-1 ;static const Dwfl_Callbacks callbacks = { .section_address = dwfl_offline_section_address, +/* +* By the time init_dwarf_info() function is called, we already +* know absolute path of debuginfo either resolved through +* search_module_debuginfo() call OR user specified vmlinux +* debuginfo through '-x' option. In which case .find_debuginfo +* callback is never invoked. +* But we can not deny a situation where user may pass invalid +* file name through '-x' option, where .find_debuginfo gets +* invoked to find a valid vmlinux debuginfo and hence we run +* into seg fault issue. Hence, set .find_debuginfo to a +* funtion pointer that returns -1 to avoid seg fault and let +* the makedumpfile throw error messages against the invalid +* vmlinux file input. +*/ + .find_debuginfo = dwarf_no_debuginfo_found }; dwarf_info.elfd =NULL ;
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi Aruna,
Quoted 9 lines · On Tue, 31 Jan 2012 15:56:33 +0530 Aruna Balakrishnaiah…
The patch fixes the segmentation fault issue of makedumpfile when a user specifies an invalid file name with -x/--split option. The patch takes care of such a scenario by setting .find_debuginfo to a function pointer which returns -1 and throws error messages against invalid vmlinux file input. With a valid vmlinux file .find_debuginfo was never invoked since the absolute path of debuginfo was known by the time we call
init_dwarf_info.
Quoted 4 lines
Signed-off-by Aruna Balakrishnaiah <[email protected]>--- dwarf_info.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
Thank you for your patch.
I will review it.
Thanks
Atsushi Kumagai
Quoted 45 lines
dwarf_info.c +25
-0@@ -204,6 +204,16 @@ search_module_debuginfo(char *os_release)return FALSE; } +static int +dwarf_no_debuginfo_found (Dwfl_Module *mod,void **userdata, +const char *modname,Dwarf_Addr base, +const char *file_name, +const char *debuglink_file,GElf_Word debuglink_crc, +char **debuginfo_file_name) +{ +return -1 ; +} +/* * Initialize the dwarf info. * Linux kernel module debuginfo are of ET_REL (relocatable) type. @@ -219,6 +229,21 @@ init_dwarf_info(void)int dwfl_fd =-1 ;static const Dwfl_Callbacks callbacks = { .section_address = dwfl_offline_section_address, +/* +* By the time init_dwarf_info() function is called, we already +* know absolute path of debuginfo either resolved through +* search_module_debuginfo() call OR user specified vmlinux +* debuginfo through '-x' option. In which case .find_debuginfo +* callback is never invoked. +* But we can not deny a situation where user may pass invalid +* file name through '-x' option, where .find_debuginfo gets +* invoked to find a valid vmlinux debuginfo and hence we run +* into seg fault issue. Hence, set .find_debuginfo to a +* funtion pointer that returns -1 to avoid seg fault and let +* the makedumpfile throw error messages against the invalid +* vmlinux file input. +*/ + .find_debuginfo = dwarf_no_debuginfo_found }; dwarf_info.elfd =NULL ;
Quoted 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi Aruna,
Quoted 18 lines · On Wed, 1 Feb 2012 13:15:18 +0900 Atsushi Kumagai…
Hi Aruna,
Quoted 13 lines · On Tue, 31 Jan 2012 15:56:33 +0530 Aruna Balakrishnaiah…
The patch fixes the segmentation fault issue of makedumpfile when a user specifies an invalid file name with -x/--split option. The patch takes care of such a scenario by setting .find_debuginfo to a function pointer which returns -1 and throws error messages against invalid vmlinux file input. With a valid vmlinux file .find_debuginfo was never invoked since the absolute path of debuginfo was known by the time we call
init_dwarf_info.Signed-off-by Aruna Balakrishnaiah <[email protected]>--- dwarf_info.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
I'm reviewing your patch and it looks good.
However, I can't guess that the segmentation fault caused by --split option because --split option doesn't require an argument.
Would you tell me the case that you thought.
Thanks
Atsushi Kumagai
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
On Thursday 23 February 2012 03:05 PM, Atsushi Kumagai wrote:
Hi Atsushi,
Quoted 22 lines
Hi Aruna,
Quoted 17 lines · On Wed, 1 Feb 2012 13:15:18 +0900 Atsushi…
Hi Aruna,
Quoted 12 lines · On Tue, 31 Jan 2012 15:56:33 +0530 Aruna…
The patch fixes the segmentation fault issue of makedumpfile when a user specifies an invalid file name with -x/--split option. The patch takes care of such a scenario by setting .find_debuginfo to a function pointer which returns -1 and throws error messages against invalid vmlinux file input. With a valid vmlinux file .find_debuginfo was never invoked since the absolute path of debuginfo was known by the time we call
init_dwarf_info.Signed-off-by Aruna Balakrishnaiah<[email protected]>--- dwarf_info.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
Quoted 6 lines
I'm reviewing your patch and it looks good.
However, I can't guess that the segmentation fault caused by --split option because --split option doesn't require an argument.
Would you tell me the case that you thought.
This is the case,
makedumpfile --split -x /boot/vmlinuz vmcore vm1 vm2
when used compressed vmlinux with -x.
Thanks,
Aruna
Quoted 3 lines
Thanks
Atsushi Kumagai
Signature · 10 lines
Regards, Aruna Balakrishnaiah<[email protected]> Linux Technology Center, IBM India Systems and Technology Lab _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Hello Aruna,
Quoted 11 lines · On Thu, 23 Feb 2012 16:12:48 +0530 Aruna Balakrishnaiah…
Quoted 6 lines
I'm reviewing your patch and it looks good.
However, I can't guess that the segmentation fault caused by --split option because --split option doesn't require an argument.
Would you tell me the case that you thought.
This is the case,
makedumpfile --split -x
/boot/vmlinuzvmcore vm1 vm2when used compressed vmlinux with -x.
Thank you for your reply, I understand.
I merged your patch into makedumpfile-1.4.3.
Thanks
Atsushi Kumagai
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec