summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViktor Prutyanov2022-10-20 01:59:48 +0200
committerMarc-André Lureau2022-10-26 10:55:00 +0200
commite38c24cb580735883769558801d9e2f2ba9f04c1 (patch)
tree98ef6afdf9f58a0ab936ed3da73e48ad21cb2461
parents390x: pv: Add dump support (diff)
downloadqemu-e38c24cb580735883769558801d9e2f2ba9f04c1.tar.gz
qemu-e38c24cb580735883769558801d9e2f2ba9f04c1.tar.xz
qemu-e38c24cb580735883769558801d9e2f2ba9f04c1.zip
dump/win_dump: limit number of processed PRCBs
When number of CPUs utilized by guest Windows is less than defined in QEMU (i.e., desktop versions of Windows severely limits number of CPU sockets), patch_and_save_context routine accesses non-existent PRCB and fails. So, limit number of processed PRCBs by NumberProcessors taken from guest Windows driver. Signed-off-by: Viktor Prutyanov <viktor.prutyanov@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221019235948.656411-1-viktor.prutyanov@redhat.com>
-rw-r--r--dump/win_dump.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dump/win_dump.c b/dump/win_dump.c
index fd91350fbb..f20b6051b6 100644
--- a/dump/win_dump.c
+++ b/dump/win_dump.c
@@ -273,6 +273,13 @@ static void patch_and_save_context(WinDumpHeader *h, bool x64,
uint64_t Context;
WinContext ctx;
+ if (i >= WIN_DUMP_FIELD(NumberProcessors)) {
+ warn_report("win-dump: number of QEMU CPUs is bigger than"
+ " NumberProcessors (%u) in guest Windows",
+ WIN_DUMP_FIELD(NumberProcessors));
+ return;
+ }
+
if (cpu_read_ptr(x64, first_cpu,
KiProcessorBlock + i * win_dump_ptr_size(x64),
&Prcb)) {