qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init
@ 2024-04-29  9:19 Philippe Mathieu-Daudé
  2024-04-29  9:19 ` [PATCH 1/2] accel/whpx: Fix NULL dereference in whpx_init_vcpu() Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-29  9:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Volker Rümelin, Sunil Muthuswamy, Reinoud Zandijk,
	Richard Henderson, Philippe =?unknown-8bit?q?Mathieu-Daud=C3=A9?=

Fix recently introduced NULL deref in NVMM/WHPX
vCPU init() handlers.

Philippe Mathieu-Daudé (2):
  accel/whpx: Fix NULL dereference in whpx_init_vcpu()
  accel/nvmm: Fix NULL dereference in nvmm_init_vcpu()

 target/i386/nvmm/nvmm-all.c | 2 +-
 target/i386/whpx/whpx-all.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] accel/whpx: Fix NULL dereference in whpx_init_vcpu()
  2024-04-29  9:19 [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init Philippe Mathieu-Daudé
@ 2024-04-29  9:19 ` Philippe Mathieu-Daudé
  2024-04-29  9:19 ` [PATCH 2/2] accel/nvmm: Fix NULL dereference in nvmm_init_vcpu() Philippe Mathieu-Daudé
  2024-04-29 12:24 ` [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-29  9:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Volker Rümelin, Sunil Muthuswamy, Reinoud Zandijk,
	Richard Henderson, Philippe Mathieu-Daudé

When mechanically moving the @dirty field to AccelCPUState
in commit 9ad49538c7, we neglected cpu->accel is still NULL
when we want to dereference it.

Fixes: 9ad49538c7 ("accel/whpx: Use accel-specific per-vcpu @dirty field")
Reported-by: Volker Rümelin <vr_qemu@t-online.de>
Suggested-by: Volker Rümelin <vr_qemu@t-online.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/whpx/whpx-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index b08e644517..a6674a826d 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -2236,7 +2236,7 @@ int whpx_init_vcpu(CPUState *cpu)
     }
 
     vcpu->interruptable = true;
-    cpu->accel->dirty = true;
+    vcpu->dirty = true;
     cpu->accel = vcpu;
     max_vcpu_index = max(max_vcpu_index, cpu->cpu_index);
     qemu_add_vm_change_state_handler(whpx_cpu_update_state, env);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] accel/nvmm: Fix NULL dereference in nvmm_init_vcpu()
  2024-04-29  9:19 [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init Philippe Mathieu-Daudé
  2024-04-29  9:19 ` [PATCH 1/2] accel/whpx: Fix NULL dereference in whpx_init_vcpu() Philippe Mathieu-Daudé
@ 2024-04-29  9:19 ` Philippe Mathieu-Daudé
  2024-04-29 12:24 ` [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-29  9:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Volker Rümelin, Sunil Muthuswamy, Reinoud Zandijk,
	Richard Henderson, Philippe Mathieu-Daudé

When mechanically moving the @dirty field to AccelCPUState
in commit 79f1926b2d, we neglected cpu->accel is still NULL
when we want to dereference it.

Reported-by: Volker Rümelin <vr_qemu@t-online.de>
Suggested-by: Volker Rümelin <vr_qemu@t-online.de>
Fixes: 79f1926b2d ("accel/nvmm: Use accel-specific per-vcpu @dirty field")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/nvmm/nvmm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
index f9cced53b3..65768aca03 100644
--- a/target/i386/nvmm/nvmm-all.c
+++ b/target/i386/nvmm/nvmm-all.c
@@ -982,7 +982,7 @@ nvmm_init_vcpu(CPUState *cpu)
         }
     }
 
-    cpu->accel->dirty = true;
+    qcpu->dirty = true;
     cpu->accel = qcpu;
 
     return 0;
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init
  2024-04-29  9:19 [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init Philippe Mathieu-Daudé
  2024-04-29  9:19 ` [PATCH 1/2] accel/whpx: Fix NULL dereference in whpx_init_vcpu() Philippe Mathieu-Daudé
  2024-04-29  9:19 ` [PATCH 2/2] accel/nvmm: Fix NULL dereference in nvmm_init_vcpu() Philippe Mathieu-Daudé
@ 2024-04-29 12:24 ` Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-04-29 12:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Volker Rümelin, Sunil Muthuswamy, Reinoud Zandijk

On 4/29/24 02:19, Philippe Mathieu-Daudé wrote:
> Philippe Mathieu-Daudé (2):
>    accel/whpx: Fix NULL dereference in whpx_init_vcpu()
>    accel/nvmm: Fix NULL dereference in nvmm_init_vcpu()

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-29 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29  9:19 [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init Philippe Mathieu-Daudé
2024-04-29  9:19 ` [PATCH 1/2] accel/whpx: Fix NULL dereference in whpx_init_vcpu() Philippe Mathieu-Daudé
2024-04-29  9:19 ` [PATCH 2/2] accel/nvmm: Fix NULL dereference in nvmm_init_vcpu() Philippe Mathieu-Daudé
2024-04-29 12:24 ` [PATCH 0/2] accel: Fix NULL deref in NVMM / WHPX vCPU init Richard Henderson

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).