[PATCH] Fix segmentation fault for makedumpfile -x/--split

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

 



Hi Aruna,

On Tue, 31 Jan 2012 15:56:33 +0530
Aruna Balakrishnaiah <aruna at linux.vnet.ibm.com> wrote:

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

Thank you for your patch.
I will review it.

Thanks
Atsushi Kumagai

> 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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec



[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