[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 55/60] dump: add fallback KDBG using in Windows dump
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 55/60] dump: add fallback KDBG using in Windows dump |
Date: |
Thu, 28 Jun 2018 22:05:05 +0200 |
From: Viktor Prutyanov <address@hidden>
KdDebuggerDataBlock may be encrypted in guest memory and dump will be
useless in this case. But guest driver can obtain decrypted KDBG and
expose its address through BugcheckParameter1 field in raw header.
After this patch, QEMU will be able to use fallback KdDebuggerDataBlock.
Signed-off-by: Viktor Prutyanov <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
win_dump.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/win_dump.c b/win_dump.c
index 7d956ca..2d9afb5 100644
--- a/win_dump.c
+++ b/win_dump.c
@@ -144,21 +144,37 @@ static void check_kdbg(WinDumpHeader64 *h, Error **errp)
{
const char OwnerTag[] = "KDBG";
char read_OwnerTag[4];
+ uint64_t KdDebuggerDataBlock = h->KdDebuggerDataBlock;
+ bool try_fallback = true;
+try_again:
if (cpu_memory_rw_debug(first_cpu,
- h->KdDebuggerDataBlock + KDBG_OWNER_TAG_OFFSET64,
+ KdDebuggerDataBlock + KDBG_OWNER_TAG_OFFSET64,
(uint8_t *)&read_OwnerTag, sizeof(read_OwnerTag), 0)) {
error_setg(errp, "win-dump: failed to read OwnerTag");
return;
}
if (memcmp(read_OwnerTag, OwnerTag, sizeof(read_OwnerTag))) {
- error_setg(errp, "win-dump: invalid KDBG OwnerTag,"
- " expected '%.4s', got '%.4s',"
- " KdDebuggerDataBlock seems to be encrypted",
- OwnerTag, read_OwnerTag);
- return;
+ if (try_fallback) {
+ /*
+ * If attempt to use original KDBG failed
+ * (most likely because of its encryption),
+ * we try to use KDBG obtained by guest driver.
+ */
+
+ KdDebuggerDataBlock = h->BugcheckParameter1;
+ try_fallback = false;
+ goto try_again;
+ } else {
+ error_setg(errp, "win-dump: invalid KDBG OwnerTag,"
+ " expected '%.4s', got '%.4s'",
+ OwnerTag, read_OwnerTag);
+ return;
+ }
}
+
+ h->KdDebuggerDataBlock = KdDebuggerDataBlock;
}
void create_win_dump(DumpState *s, Error **errp)
--
1.8.3.1
- [Qemu-devel] [PULL 46/60] doc: another fix to "info pic", (continued)
- [Qemu-devel] [PULL 46/60] doc: another fix to "info pic", Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 44/60] target-i386: Allow interrupt injection after STGI, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 45/60] target-i386: Mark cpu_vmexit noreturn, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 47/60] ioapic: support "info pic", Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 49/60] ioapic: support "info irq", Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 51/60] kvm: support -overcommit cpu-pm=on|off, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 52/60] i386/cpu: make -cpu host support monitor/mwait, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 54/60] dump: use system context in Windows dump, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 56/60] dump: add Windows live system dump, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 53/60] dump: add Windows dump format to dump-guest-memory, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 55/60] dump: add fallback KDBG using in Windows dump,
Paolo Bonzini <=
- [Qemu-devel] [PULL 50/60] hmp: obsolete "info ioapic", Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 58/60] hw/scsi: centralize SG_IO calls into single function, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 60/60] tests/boot-serial: Do not delete the output file in case of errors, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 59/60] hw/scsi: add VPD Block Limits emulation, Paolo Bonzini, 2018/06/28
- [Qemu-devel] [PULL 57/60] hw/scsi: cleanups before VPD BL emulation, Paolo Bonzini, 2018/06/28
- Re: [Qemu-devel] [PULL 00/60] Misc patches for soft freeze, Peter Maydell, 2018/06/29