From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Subject: [PULL 06/32] accel/mshv: Fix pointer to proc feature bitfield
Date: Mon, 6 Jul 2026 15:45:01 +0200 [thread overview]
Message-ID: <20260706134527.84808-7-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260706134527.84808-1-philmd@oss.qualcomm.com>
From: Magnus Kulke <magnuskulke@linux.microsoft.com>
Processor features are stored in a union containing two "banks":
union hv_partition_processor_features {
uint64_t as_uint[2];
struct {
uint64_t sse3_support:1;
...
}
}
get_proc_features() to retrieve the 2nd bank was passing a pointer that
steps over the whole union (+16B) instead of picking the 2nd bank _in_
the union. This manifests in mismatching feature bits for the 2nd bank
and possibly other side-effects caused by writing beyond the union.
We need to step over the first bank (+8B) by using as_uint64[0/1] to
correct this behaviour.
Resolves: Coverity CID 1660876
Fixes: 2f6da91e8a ("accel/mshv: store partition proc features")
Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20260701130335.418156-1-magnuskulke@linux.microsoft.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/mshv/mshv-all.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
index 1959baf6672..72721d0f0de 100644
--- a/accel/mshv/mshv-all.c
+++ b/accel/mshv/mshv-all.c
@@ -167,7 +167,7 @@ static int get_proc_features(int vm_fd,
ret = get_partition_property(vm_fd,
HV_PARTITION_PROPERTY_PROCESSOR_FEATURES0,
- features[0].as_uint64);
+ &features->as_uint64[0]);
if (ret < 0) {
error_report("Failed to get processor features bank 0");
return -1;
@@ -175,7 +175,7 @@ static int get_proc_features(int vm_fd,
ret = get_partition_property(vm_fd,
HV_PARTITION_PROPERTY_PROCESSOR_FEATURES1,
- features[1].as_uint64);
+ &features->as_uint64[1]);
if (ret < 0) {
error_report("Failed to get processor features bank 1");
return -1;
--
2.53.0
next prev parent reply other threads:[~2026-07-06 13:47 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 13:44 [PULL 00/32] Accelerator patches for 2026-07-06 Philippe Mathieu-Daudé
2026-07-06 13:44 ` [PULL 01/32] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
2026-07-06 13:44 ` [PULL 02/32] target/i386: Remove duplicate tlb_flush() call in cpu_post_load() Philippe Mathieu-Daudé
2026-07-06 13:44 ` [PULL 03/32] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG Philippe Mathieu-Daudé
2026-07-06 13:44 ` [PULL 04/32] accel/hvf: Remove left-over comment Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 05/32] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field Philippe Mathieu-Daudé
2026-07-06 13:45 ` Philippe Mathieu-Daudé [this message]
2026-07-06 13:45 ` [PULL 07/32] gdbstub: Add trace event for STEP packet handler Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 08/32] gdbstub: Only return E22 when reverse GDB is not supported Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 09/32] accel/whpx: Implement missing AccelClass::gdbstub_supported_sstep_flags Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 10/32] accel/kvm: Always define AccelOpsClass::supports_guest_debug Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 11/32] accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 12/32] accel/kvm: Hold have_guest_debug in KVMState Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 13/32] gdbstub: Reduce gdb_supports_guest_debug() scope Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 14/32] gdbstub: Move supported_sstep_flags in AccelGdbConfig structure Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 15/32] accel: Have each implementation return their AccelGdbConfig Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 16/32] gdbstub: Make default replay_mode value explicit in stubs Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 17/32] accel: Hold @can_reverse information in AccelGdbConfig Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 18/32] accel: Remove AccelOpsClass::supports_guest_debug Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 19/32] cpu: Move cpu_breakpoint_test out of line Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 20/32] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h' Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 21/32] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 22/32] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 23/32] gdbstub: Reduce @type variable scope Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 24/32] gdbstub: Introduce GdbBreakpointType enumerator Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 25/32] accel: Use GdbBreakpointType enum Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 26/32] target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint() Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 27/32] target/ppc: Ensure TCG is used in ppc_update_daw() Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 28/32] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 29/32] cpu: Better name cpu_single_step() trace event Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 30/32] cpu: Introduce cpu_single_stepping() helper Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 31/32] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags Philippe Mathieu-Daudé
2026-07-06 13:45 ` [PULL 32/32] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping() Philippe Mathieu-Daudé
2026-07-07 5:04 ` [PULL 00/32] Accelerator patches for 2026-07-06 Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260706134527.84808-7-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.