From: Sean Christopherson <seanjc@google.com>
To: Binbin Wu <binbin.wu@linux.intel.com>
Cc: Xiaoyao Li <xiaoyao.li@intel.com>,
kvm@vger.kernel.org, pbonzini@redhat.com,
rick.p.edgecombe@intel.com, chao.gao@intel.com,
kai.huang@intel.com
Subject: Re: [RFC PATCH 00/27] KVM: x86: Add a paranoid mode for CPUID verification
Date: Mon, 18 May 2026 07:29:20 -0700 [thread overview]
Message-ID: <agsiQGikhZA0CGTY@google.com> (raw)
In-Reply-To: <bf569f46-8690-4f82-a2a0-d196970880de@linux.intel.com>
On Mon, May 18, 2026, Binbin Wu wrote:
> On 5/15/2026 4:08 PM, Xiaoyao Li wrote:
> > On 4/17/2026 3:35 PM, Binbin Wu wrote:
> >> Hi,
> >>
> >> This RFC series is to allow public capture of feedback from TDX
> >> developers before we have too much internal conversations on it and to
> >> initiate code review of Sashiko. It is not yet intended for review by
> >> KVM maintainers. Sean and Paolo, please feel free to ignore this version.
> >>
> >> Originally, we had issues on TDX when a new hardware feature, which is a
> >> host state clobbering feature, is supported by new TDX modules/platforms.
> >> A host state clobbering feature requires KVM to save and restore the
> >> feature's related MSR(s) on host/guest transitions; otherwise, if the
> >> feature is used by TDs, the host state will be corrupted, leading to
> >> unexpected behavior on the host.
> >>
> >> Currently KVM hardcodes a deny list for unsupported host clobbering
> >> features for TDX, i.e. HLE, RTM and WAITPKG. However, KVM can't keep a
> >> list of bits that it may not know about (e.g. the upcoming FRED support
> >> in TDX).
> >>
> >> We had been working internally to propose a TDX specific solution to
> >> solve the host state clobbering feature issue. But during a PUCK meeting,
> >> Sean mentioned that KVM had a more permissive CPUID configuration
> >> interface than desired and there were problems due to it in the past for
> >> normal VMs as well.
> >
> > It will be better if some detailed example of problems on normal VMs can be
> > provided.
>
> Sean mentioned it in PUCK meeting that google internally had some issues before,
> but he didn't tell the details.
For far too long, our VMM didn't sanity check the vCPU model being presented to
the guest against KVM_GET_SUPPORTED_CPUID2. That's what I'm envisioning for KVM:
something akin to QEMU's default behavior, where QEMU refuses to create a VM if
the user enables unsupported features, unless the users also enables the "let me
shoot myself in the foot" flag.
> >> Sean suggested that KVM should introduce a more
> >> paranoid mode to check CPUID from userspace for VMs in general, as well
> >> as an opt-in interface for userspace. And TDX should use the
> >> infrastructure to enforce paranoid mode non-optionally.
> >>
> >> This RFC patch series adds a paranoid CPUID verification mode for KVM on>
> >> x86, where KVM must be explicitly aware of every CPUID feature exposed to
> >> the guest. When the CPUID paranoid mode is opted-in by userspace or
> >> enforced, KVM will reject any unknown or unsupported feature from
> >> userspace. And it starts to enforce paranoid CPUID verification for TDX.
> >
> > Regarding the opt-in interface (for normal VMs), I want to know what the
> > benefit it brings for normal VMs when it's opted-in.
More or less the same benefits QEMU's default behavior provides. Whether or not
the value added, relative to what userspace can/does do, is worth the complexity?
Dunno. I haven't looked through the series, but this:
15 files changed, 1298 insertions(+), 525 deletions(-)
definitely gives me pause.
> > If it can make the host more robust or prevent potential attack from
> > malicious userspace + guest, then it should certainly be forced on instead
> > of userspace to opt-in.
> >
> > If no good benefit, I doubt any userspace will opt it in. E.g, I can see
> > one benefit without the paranoid mode: Userspace can expose the new simple
> > x86 Instruction to guest before KVM supports it by adding one line of
> > F(xxx) in kvm_initialize_cpu_caps()
> >
>
> As Rick replied, Sean thought for normal VMs, it could be opted-in to do debug
> or even make it enabled by default.
I doubt we'll ever enabled it by default. I can see us providing a module param,
so that a deployment can effectively enable it by default, but truly enabling it
by default in KVM will likely never happen.
next prev parent reply other threads:[~2026-05-18 14:29 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 7:35 [RFC PATCH 00/27] KVM: x86: Add a paranoid mode for CPUID verification Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 01/27] KVM: x86: Fix emulated CPUID features being applied to wrong sub-leaf Binbin Wu
2026-05-15 9:03 ` Xiaoyao Li
2026-05-18 8:09 ` Binbin Wu
2026-05-18 10:51 ` Xiaoyao Li
2026-06-08 1:58 ` Binbin Wu
2026-06-08 14:19 ` Sean Christopherson
2026-06-09 1:56 ` Binbin Wu
2026-06-09 3:00 ` Sean Christopherson
2026-04-17 7:35 ` [RFC PATCH 02/27] KVM: x86: Reorder the features for CPUID 7 Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 03/27] KVM: x86: Add definitions for CPUID overlays Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 04/27] KVM: x86: Extend F() and its variants " Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 05/27] KVM: x86: Extend kvm_cpu_cap_{set/clear}() to configure overlays Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 06/27] KVM: x86: Populate TDX CPUID overlay with supported feature bits Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 07/27] KVM: x86: Support KVM_GET_{SUPPORTED,EMULATED}_CPUID as VM scope ioctls Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 08/27] KVM: x86: Thread @kvm to KVM CPU capability helpers Binbin Wu
2026-04-21 6:18 ` Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 09/27] KVM: x86: Use overlays of KVM CPU capabilities Binbin Wu
2026-04-21 5:31 ` Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 10/27] KVM: x86: Use vendor-specific overlay flags instead of F_CPUID_DEFAULT Binbin Wu
2026-04-21 6:43 ` Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 11/27] KVM: SVM: Drop unnecessary clears of unsupported common x86 features Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 12/27] KVM: x86: Split KVM CPU cap leafs into two parts Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 13/27] KVM: x86: Add a helper to initialize CPUID multi-bit fields Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 14/27] KVM: x86: Add a helper to init multiple feature bits based on raw CPUID Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 15/27] KVM: x86: Add infrastructure to track CPUID entries ignored in paranoid mode Binbin Wu
2026-04-17 7:35 ` [RFC PATCH 16/27] KVM: x86: Init allowed masks for basic CPUID range " Binbin Wu
2026-04-21 6:51 ` Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 17/27] KVM: x86: Init allowed masks for extended " Binbin Wu
2026-04-21 7:55 ` Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 18/27] KVM: x86: Handle Centaur CPUID leafs " Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 19/27] KVM: x86: Track KVM PV CPUID features for " Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 20/27] KVM: x86: Add per-VM flag to track CPUID " Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 21/27] KVM: x86: Make kvm_vcpu_after_set_cpuid() return an error code Binbin Wu
2026-04-22 8:22 ` Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 22/27] KVM: x86: Verify userspace CPUID inputs in paranoid mode Binbin Wu
2026-04-22 8:59 ` Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 23/27] KVM: x86: Account for runtime CPUID features " Binbin Wu
2026-04-23 2:41 ` Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 24/27] KVM: x86: Skip paranoid CPUID check for KVM PV leafs when base is relocated Binbin Wu
2026-04-23 3:02 ` Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 25/27] KVM: x86: Add new KVM_CAP_X86_CPUID_PARANOID Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 26/27] KVM: x86: Add a helper to query the allowed CPUID mask Binbin Wu
2026-04-17 7:36 ` [RFC PATCH 27/27] KVM: TDX: Replace hardcoded CPUID filtering with the allowed mask Binbin Wu
2026-04-23 3:25 ` Binbin Wu
2026-05-15 8:08 ` [RFC PATCH 00/27] KVM: x86: Add a paranoid mode for CPUID verification Xiaoyao Li
2026-05-15 15:45 ` Edgecombe, Rick P
2026-05-18 7:58 ` Binbin Wu
2026-05-18 14:29 ` Sean Christopherson [this message]
2026-05-18 20:55 ` Edgecombe, Rick P
2026-05-19 2:36 ` Binbin Wu
2026-05-19 3:03 ` Edgecombe, Rick P
2026-05-18 1:38 ` Xiaoyao Li
2026-05-18 7:24 ` Binbin Wu
2026-05-18 7:47 ` 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=agsiQGikhZA0CGTY@google.com \
--to=seanjc@google.com \
--cc=binbin.wu@linux.intel.com \
--cc=chao.gao@intel.com \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox