From: Sean Christopherson <seanjc@google.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: x86: Explicitly set eax and ebx to 0 when X86_FEATURE_PERFMON_V2 cannot be exposed to guest
Date: Tue, 4 Mar 2025 06:29:30 -0800 [thread overview]
Message-ID: <Z8cOSq1shwIRm3wG@google.com> (raw)
In-Reply-To: <20250304082314.472202-3-xiaoyao.li@intel.com>
On Tue, Mar 04, 2025, Xiaoyao Li wrote:
> It wrongly exposes the host ebx value of leaf 0x80000022 to userspace
> when it's supposed to return 0.
>
> Fixes: 94cdeebd8211 ("KVM: x86/cpuid: Add AMD CPUID ExtPerfMonAndDbg leaf 0x80000022")
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> arch/x86/kvm/cpuid.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index f9a9175e3fe8..5e4d4934c0d3 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -1767,7 +1767,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
>
> entry->ecx = entry->edx = 0;
> if (!enable_pmu || !kvm_cpu_cap_has(X86_FEATURE_PERFMON_V2)) {
> - entry->eax = entry->ebx;
Ugh, that typo came from me:
https://lore.kernel.org/all/Y1sIHXX3HEJEXJm+@google.com
> + entry->eax = entry->ebx = 0;
> break;
> }
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-03-04 14:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 8:23 [PATCH 0/2] KVM: x86: Cleanup and fix for reporting CPUID leaf 0x80000022 Xiaoyao Li
2025-03-04 8:23 ` [PATCH 1/2] KVM: x86: Remove the unreachable case for 0x80000022 leaf in __do_cpuid_func() Xiaoyao Li
2025-03-04 8:23 ` [PATCH 2/2] KVM: x86: Explicitly set eax and ebx to 0 when X86_FEATURE_PERFMON_V2 cannot be exposed to guest Xiaoyao Li
2025-03-04 14:29 ` Sean Christopherson [this message]
2025-03-06 0:57 ` [PATCH 0/2] KVM: x86: Cleanup and fix for reporting CPUID leaf 0x80000022 Sean Christopherson
2025-03-06 1:46 ` Xiaoyao Li
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=Z8cOSq1shwIRm3wG@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=xiaoyao.li@intel.com \
/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.