Hello Dave,
Let me send you a cleanup/fix for Xen DomU dumps.
When opening a Xen DomU dump without auto-translated addresses (e.g.
from an x86_64 PV domain), a mapping between physical and machine
pages is needed. An xc_core dump file does not contain this mapping,
so it must be created by arch-specific code from the dumped data.
This (and only this) is the job of the machdep->xendump_p2m_create
callback, which is called if the XC_CORE_P2M_CREATE flag is set. ELF
files contain the mapping in a separate section (".xen_p2m"), so this
arch-specific code is not needed and should not be run.
On the other hand, XC_CORE_P2M_CREATE also triggers the initialization
of the elf_index_pfn array. I believe this should be in fact controlled
by XC_CORE_PFN_CREATE, because the flag is not used for anything else.
I found this issue thanks to a Xen DomU ELF dump file that contained an
invalid CR3 value, which could not be used to translate kvaddr to maddr.
Without the patch, session initialization fails with these messages:
crash: cannot find mfn 0 (0x0) in page index
crash: cannot read/find pud page
Signed-off-by: Petr Tesarik <[email protected]>
Do not create arch-specific p2m mapping for ELF xen dumps
From: Petr Tesarik <[email protected]>
When opening a Xen DomU dump without auto-translated addresses (e.g.
from an x86_64 PV domain), a mapping between physical and machine
pages is needed. An xc_core dump file does not contain this mapping,
so it must be created by arch-specific code from the dumped data.
This (and only this) is the job of the machdep->xendump_p2m_create
callback, which is called if the XC_CORE_P2M_CREATE flag is set. ELF
files contain the mapping in a separate section (".xen_p2m"), so this
arch-specific code is not needed and should not be run.
On the other hand, XC_CORE_P2M_CREATE also triggers the initialization
of the elf_index_pfn array. I believe this should be in fact controlled
by XC_CORE_PFN_CREATE, because the flag is not used for anything else.
I found this issue thanks to a Xen DomU ELF dump file that contained an
invalid CR3 value, which could not be used to translate kvaddr to maddr.
Without the patch, session initialization fails with these messages:
crash: cannot find mfn 0 (0x0) in page index
crash: cannot read/find pud page
Signed-off-by: Petr Tesarik <[email protected]>
---
xendump.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xendump.c b/xendump.c
index 7f89874..8170b22 100644
--- a/xendump.c
+++ b/xendump.c
@@ -1260,7 +1260,7 @@ xc_core_create_pfn_tables(void)
"cannot create xen pfn-to-mfn mapping\n");
}
- if (xd->flags & XC_CORE_ELF)
+ if (xd->flags & XC_CORE_PFN_CREATE)
xc_core_elf_pfn_init();
xd->flags &= ~(XC_CORE_P2M_CREATE|XC_CORE_PFN_CREATE);
@@ -2557,7 +2557,7 @@ xc_core_dump_Elf32_Shdr(Elf32_Off offset, int store)
if (STREQ(name, ".xen_p2m")) {
xd->xc_core.header.xch_index_offset =
(off_t)shdr.sh_offset;
- xd->flags |= XC_CORE_P2M_CREATE;
+ xd->flags |= XC_CORE_PFN_CREATE;
}
if (STREQ(name, ".xen_pages"))
@@ -2659,7 +2659,7 @@ xc_core_dump_Elf64_Shdr(Elf64_Off offset, int store)
if (STREQ(name, ".xen_p2m")) {
xd->xc_core.header.xch_index_offset =
(off_t)shdr.sh_offset;
- xd->flags |= XC_CORE_P2M_CREATE;
+ xd->flags |= XC_CORE_PFN_CREATE;
}
if (STREQ(name, ".xen_pages"))
--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility