All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH qemu] target/i386: Fix x86_cpu_get_supported_cpuid parameter error in cpu_x86_cpuid
@ 2022-06-01 17:12 ~xiangyi
  0 siblings, 0 replies; only message in thread
From: ~xiangyi @ 2022-06-01 17:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Richard Henderson, qemu-devel

From: Xiangyi Meng <xymeng16@gmail.com>

count should be the second parameter of x86_cpu_get_supported_cpuid.
If not, when guest is querying 0x12H related CPUID leafs, any of the
four registers will possibly be zero, incurring some strange behaviors, like,
virtual SGX is enabled by the user but the guest OS reports SGX1 instruction
is not supported, etc.

Signed-off-by: Xiangyi Meng <xymeng16@gmail.com>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index bb6a5dd498..9fdfec9d8b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5559,7 +5559,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
          * supports.  Features can be further restricted by userspace, but not
          * made more permissive.
          */
-        x86_cpu_get_supported_cpuid(0x12, index, eax, ebx, ecx, edx);
+        x86_cpu_get_supported_cpuid(0x12, count, eax, ebx, ecx, edx);
 
         if (count == 0) {
             *eax &= env->features[FEAT_SGX_12_0_EAX];
-- 
2.34.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-01 19:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 17:12 [PATCH qemu] target/i386: Fix x86_cpu_get_supported_cpuid parameter error in cpu_x86_cpuid ~xiangyi

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.