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

* Re: [PATCH] Fix segmentation fault for makedumpfile -x/--split
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Kumagai @ 2012-02-01  4:15 UTC (permalink / raw)
  To: aruna; +Cc: tachibana, kexec

Hi Aruna,

On Tue, 31 Jan 2012 15:56:33 +0530
Aruna Balakrishnaiah <aruna@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@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@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Fix segmentation fault for makedumpfile -x/--split
  2012-02-01  4:15 ` Atsushi Kumagai
@ 2012-02-23  9:35   ` Atsushi Kumagai
  2012-02-23 10:42     ` Aruna Balakrishnaiah
  0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Kumagai @ 2012-02-23  9:35 UTC (permalink / raw)
  To: aruna; +Cc: tachibana, kexec

Hi Aruna,

On Wed, 1 Feb 2012 13:15:18 +0900
Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp> wrote:

> Hi Aruna,
> 
> On Tue, 31 Jan 2012 15:56:33 +0530
> Aruna Balakrishnaiah <aruna@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@linux.vnet.ibm.com>
> > ---
> >  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
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Fix segmentation fault for makedumpfile -x/--split
  2012-02-23  9:35   ` Atsushi Kumagai
@ 2012-02-23 10:42     ` Aruna Balakrishnaiah
  2012-02-24  3:05       ` Atsushi Kumagai
  0 siblings, 1 reply; 5+ messages in thread
From: Aruna Balakrishnaiah @ 2012-02-23 10:42 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: tachibana, kexec, aruna

On Thursday 23 February 2012 03:05 PM, Atsushi Kumagai wrote:
Hi Atsushi,

> Hi Aruna,
>
> On Wed, 1 Feb 2012 13:15:18 +0900
> Atsushi Kumagai<kumagai-atsushi@mxc.nes.nec.co.jp>  wrote:
>
>> Hi Aruna,
>>
>> On Tue, 31 Jan 2012 15:56:33 +0530
>> Aruna Balakrishnaiah<aruna@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@linux.vnet.ibm.com>
>>> ---
>>>   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.
This is the case,

makedumpfile --split -x /boot/vmlinuz vmcore vm1 vm2

when used compressed vmlinux with -x.

Thanks,
Aruna


> Thanks
> Atsushi Kumagai
>


-- 
Regards,
Aruna Balakrishnaiah<aruna@linux.vnet.ibm.com>
Linux Technology Center,
IBM India Systems and Technology Lab


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] Fix segmentation fault for makedumpfile -x/--split
  2012-02-23 10:42     ` Aruna Balakrishnaiah
@ 2012-02-24  3:05       ` Atsushi Kumagai
  0 siblings, 0 replies; 5+ messages in thread
From: Atsushi Kumagai @ 2012-02-24  3:05 UTC (permalink / raw)
  To: arunabal; +Cc: tachibana, kexec

Hello Aruna,

On Thu, 23 Feb 2012 16:12:48 +0530
Aruna Balakrishnaiah <arunabal@linux.vnet.ibm.com> wrote:

> > 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.

Thank you for your reply, I understand.
I merged your patch into makedumpfile-1.4.3.

Thanks
Atsushi Kumagai

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[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.