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>
Cc: "'ats-kumagai@wm.jp.nec.com'" <ats-kumagai@wm.jp.nec.com>,
	"'kexec@lists.infradead.org'" <kexec@lists.infradead.org>,
	"'bhe@redhat.com'" <bhe@redhat.com>
Subject: Re: [PATCH 2/2] Revert "[PATCH V2 1/4] x86_64: Calculate page_offset from pt_load"
Date: Tue, 23 May 2017 14:05:42 +0530	[thread overview]
Message-ID: <c3807eca-ff7e-73b9-1382-7a92dbed04bb@redhat.com> (raw)
In-Reply-To: <33710E6CAA200E4583255F4FB666C4E20D2060C9@G01JPEXMBYT03>



On Tuesday 23 May 2017 12:55 PM, Hatayama, Daisuke wrote:
> Pratysh,
>
>> -----Original Message-----
>> From: Pratyush Anand [mailto:panand@redhat.com]
>> Sent: Tuesday, May 23, 2017 1:12 PM
>> 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>;
>> 'bhe@redhat.com' <bhe@redhat.com>
>> Subject: Re: [PATCH 2/2] Revert "[PATCH V2 1/4] x86_64: Calculate page_offset
>> from pt_load"
>>
>>
>>
>> On Tuesday 23 May 2017 08:53 AM, Pratyush Anand wrote:
>>> Hi Hatayama,
>>>
>>> On Tuesday 23 May 2017 08:24 AM, Hatayama, Daisuke wrote:
>>>> This reverts commit 0c9dd01d8ee2e4ec1821a11f5e174fdba56012b8 because
>>>> the logic works well only on the kdump ELF format. It doesn't work
>>>> well on sadump vmcores and qemu/KVM guest vmcores created by virsh
>>>> dump --memory-only command where info->page_offset results in 0. These
>>>> formats have to depend on kernel version dependency in the current
>>>> situation.
>>>
>>> I do not think that we should just revert it. Revert will break things on
>>> KASLR enabled kernel.
>>>
>>> I have already posted a patch to calculate page_offset when pt_load is not
>>> available.
>>>
>>> http://lists.infradead.org/pipermail/kexec/2017-May/018747.html
>>>
>>> Probably,I can improve that patch in next version so that it takes care of
>>> sadump case as well.
>>>
>>
>> Can you please try following patches from
>> https://github.com/pratyushanand/makedumpfile.git : devel
>>
>> https://github.com/pratyushanand/makedumpfile/commit/ba93c349ac5d097a51c22
>> 1e39816da5fef2e5f58
>
> strtoul() is better than strtol() because info->kaslr_offset is of unsigned long,
> though there's no runtime error in this case.

ok.

>
>> https://github.com/pratyushanand/makedumpfile/commit/241ecc6d96afbf7be6e02
>> f51e882ce5e1e2eb9d0
>
> This patch works fine on sadump vmcores, but doesn't look good on virsh dump --memory-only.
> The vmcore created by virsh dump --memory-only command is written in ELF format.
> Virtual addresses assigned into it differs from the kdump one, not reflecting
> kernel runtime virtual addresses.
>
> Here is a sample readelf output:
>
> # LANG=C readelf -l /root/vmcore-by-virsh-dump
>
> Elf file type is CORE (Core file)
> Entry point 0x0
> There are 7 program headers, starting at offset 64
>
> Program Headers:
>   Type           Offset             VirtAddr           PhysAddr
>                  FileSiz            MemSiz              Flags  Align
>   NOTE           0x00000000000001c8 0x0000000000000000 0x0000000000000000
>                  0x0000000000000650 0x0000000000000650         0
>   LOAD           0x0000000000000818 0x0000000000000000 0x0000000000000000
>                  0x00000000000a0000 0x00000000000a0000         0
>   LOAD           0x00000000000a0818 0x0000000000000000 0x00000000000a0000
>                  0x0000000000010000 0x0000000000010000         0
>   LOAD           0x00000000000b0818 0x0000000000000000 0x00000000000c0000
>                  0x0000000000020000 0x0000000000020000         0
>   LOAD           0x00000000000d0818 0x0000000000000000 0x00000000000e0000
>                  0x0000000000020000 0x0000000000020000         0
>   LOAD           0x00000000000f0818 0x0000000000000000 0x0000000000100000
>                  0x000000003ff00000 0x000000003ff00000         0
>   LOAD           0x000000003fff0818 0x0000000000000000 0x00000000f0000000
>                  0x0000000001000000 0x0000000001000000         0
>
> How about using QEMU or VMCOREINFO to distinguish QEMU ELF vmcore from
> kdump ELF vmcore?

Thanks for investigating it.

I am not sure why all the virtual address in above PT_LOAD is 0 (which is  
invalid). However, this information can be used similar to how we use  
NOT_PADDR (if virt addresses are always invalid in case of virsh dump).

So what about following updated patch:
https://github.com/pratyushanand/makedumpfile/commit/52387707bb8a8c0c0645215fcbf4eef60c7e4aaf


~Pratyush

>
> I think you know what VMCOREINFO is, and here is QEMU note information example:
>
> # LANG=C readelf -n /root/vmcore
>
> Displaying notes found at file offset 0x000001c8 with length 0x00000650:
>   Owner                 Data size       Description
>   CORE                 0x00000150       NT_PRSTATUS (prstatus structure)
>   CORE                 0x00000150       NT_PRSTATUS (prstatus structure)
>   QEMU                 0x000001b0       Unknown note type: (0x00000000)
>   QEMU                 0x000001b0       Unknown note type: (0x00000000)
>

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

  reply	other threads:[~2017-05-23  8:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23  2:54 [PATCH 2/2] Revert "[PATCH V2 1/4] x86_64: Calculate page_offset from pt_load" Hatayama, Daisuke
2017-05-23  3:23 ` Pratyush Anand
2017-05-23  4:12   ` Pratyush Anand
2017-05-23  7:25     ` Hatayama, Daisuke
2017-05-23  8:35       ` Pratyush Anand [this message]
2017-05-24  2:09         ` Hatayama, Daisuke
2017-05-24  5:43           ` Pratyush Anand
2017-05-24  6:21             ` Pratyush Anand
2017-05-25  1:11               ` Hatayama, Daisuke

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=c3807eca-ff7e-73b9-1382-7a92dbed04bb@redhat.com \
    --to=panand@redhat.com \
    --cc=ats-kumagai@wm.jp.nec.com \
    --cc=bhe@redhat.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