* [PATCH] dump/win_dump: limit number of processed PRCBs
@ 2022-10-19 23:59 Viktor Prutyanov
2022-10-20 7:54 ` Marc-André Lureau
0 siblings, 1 reply; 2+ messages in thread
From: Viktor Prutyanov @ 2022-10-19 23:59 UTC (permalink / raw)
To: marcandre.lureau; +Cc: qemu-devel, yan, viktor.prutyanov
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>
---
dump/win_dump.c | 7 +++++++
1 file changed, 7 insertions(+)
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)) {
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dump/win_dump: limit number of processed PRCBs
2022-10-19 23:59 [PATCH] dump/win_dump: limit number of processed PRCBs Viktor Prutyanov
@ 2022-10-20 7:54 ` Marc-André Lureau
0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2022-10-20 7:54 UTC (permalink / raw)
To: Viktor Prutyanov; +Cc: qemu-devel, yan
[-- Attachment #1: Type: text/plain, Size: 1508 bytes --]
Hi
On Thu, Oct 20, 2022 at 3:59 AM Viktor Prutyanov <
viktor.prutyanov@redhat.com> wrote:
> 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>
>
Assuming the used CPUs are in the same order. Or is there a way to query it
instead?
lgtm otherwise
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> dump/win_dump.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> 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)) {
> --
> 2.35.1
>
>
[-- Attachment #2: Type: text/html, Size: 2304 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-20 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-19 23:59 [PATCH] dump/win_dump: limit number of processed PRCBs Viktor Prutyanov
2022-10-20 7:54 ` Marc-André Lureau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).