All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix segmentation fault for makedumpfile -x/--split
@ 2012-01-31 10:26 Aruna Balakrishnaiah
  2012-02-01  4:15 ` Atsushi Kumagai
  0 siblings, 1 reply; 5+ messages in thread
From: Aruna Balakrishnaiah @ 2012-01-31 10:26 UTC (permalink / raw)
  To: kexec; +Cc: tachibana


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 <aruna@linux.vnet.ibm.com>
---
 dwarf_info.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/dwarf_info.c b/dwarf_info.c
index 46dcd8e..515455d 100644
--- a/dwarf_info.c
+++ b/dwarf_info.c
@@ -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
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-24  3:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-31 10:26 [PATCH] Fix segmentation fault for makedumpfile -x/--split Aruna Balakrishnaiah
2012-02-01  4:15 ` Atsushi Kumagai
2012-02-23  9:35   ` Atsushi Kumagai
2012-02-23 10:42     ` Aruna Balakrishnaiah
2012-02-24  3:05       ` Atsushi Kumagai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.