Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Anand <panand@redhat.com>
To: "Hatayama, Daisuke" <d.hatayama@jp.fujitsu.com>,
	"'ats-kumagai@wm.jp.nec.com'" <ats-kumagai@wm.jp.nec.com>
Cc: "'kexec@lists.infradead.org'" <kexec@lists.infradead.org>
Subject: Re: [PATCH 1/2] sadump: set info->page_size before cache_init()
Date: Thu, 25 May 2017 13:22:43 +0530	[thread overview]
Message-ID: <b71ddf08-b21b-c75e-1028-2ea1fa3ceb28@redhat.com> (raw)
In-Reply-To: <33710E6CAA200E4583255F4FB666C4E20D205BEE@G01JPEXMBYT03>



On Tuesday 23 May 2017 08:22 AM, Hatayama, Daisuke wrote:
> Currently, makedumpfile results in Segmentation fault on sadump dump
> files as follows:
>
>     # LANG=C makedumpfile -f --message-level=31 -ld31 -x vmlinux ./sadump_vmcore sadump_vmcore-ld31
>     sadump: read dump device as single partition
>     sadump: single partition configuration
>     page_size    : 4096
>     sadump: timezone information is missing
>     Segmentation fault
>
> By bisect, I found that this issue is caused by the following commit
> that moves invocation of cache_init() in initial() a bit early:
>
>     # git bisect bad
>     8e2834bac4f62da3894da297f083068431be6d80 is the first bad commit
>     commit 8e2834bac4f62da3894da297f083068431be6d80
>     Author: Pratyush Anand <panand@redhat.com>
>     Date:   Thu Mar 2 17:37:11 2017 +0900
>
>         [PATCH v3 2/7] initial(): call cache_init() a bit early
>
>         Call cache_init() before get_kcore_dump_loads(), because latter uses
>         cache_search().
>
>         Call path is like this :
>         get_kcore_dump_loads() -> process_dump_load() -> vaddr_to_paddr() ->
>         vtop4_x86_64() -> readmem() -> cache_search()
>
>         Signed-off-by: Pratyush Anand <panand@redhat.com>
>
>     :100644 100644 6942047199deb09dd1fff2121e264584dbb05587 3b8e9810468de26b0d8b73d456f0bd4f3d3aa2fe M      makedumpfile.c
>
> In this timing, on sadump vmcores, info->page_size has not been
> initialized yet so has 0. So, malloc() in cache_init() returns a chunk
> of 0 size. A bit later, info->page_size is initialized with 4096.
> Later processing on cache.c behaves assuming the chunk size is 8 *
> 4096. This destroys objects allocated after the chunk, resulting in
> the above Segmentation fault.
>
> To fix this issue, this commit moves setting info->page_size before
> cache_init().
>
> Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
> Cc: Pratyush Anand <panand@redhat.com>

For 1/2
Reviewed-by: Pratyush Anand <panand@redhat.com>


> ---
>  makedumpfile.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/makedumpfile.c b/makedumpfile.c
> index 301772a..f300b19 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -3878,6 +3878,9 @@ initial(void)
>  	if (!get_value_for_old_linux())
>  		return FALSE;
>
> +	if (info->flag_sadump && !set_page_size(sadump_page_size()))
> +			return FALSE;
> +
>  	if (!is_xen_memory() && !cache_init())
>  		return FALSE;
>
> @@ -3906,9 +3909,6 @@ initial(void)
>  			return FALSE;
>  		}
>
> -		if (!set_page_size(sadump_page_size()))
> -			return FALSE;
> -
>  		if (!sadump_initialize_bitmap_memory())
>  			return FALSE;
>
>

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

  reply	other threads:[~2017-05-25  7:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23  2:52 [PATCH 1/2] sadump: set info->page_size before cache_init() Hatayama, Daisuke
2017-05-25  7:52 ` Pratyush Anand [this message]
2017-05-26  7:46   ` Atsushi Kumagai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b71ddf08-b21b-c75e-1028-2ea1fa3ceb28@redhat.com \
    --to=panand@redhat.com \
    --cc=ats-kumagai@wm.jp.nec.com \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox