]> git.hungrycats.org Git - linux/commit
KVM: VMX: Disallow using to_vmx() in common VT code
authorSean Christopherson <seanjc@google.com>
Fri, 4 Sep 2026 01:03:46 +0000 (18:03 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:10:47 +0000 (12:10 -0500)
commit045e0736e5bd3cc8030bf7c60ed404c368b077b7
tree090acf79a56a55fbde0b7b1125b6da852a17eea6
parent61478eb01872a86d54c934028c948fae746f651b
KVM: VMX: Disallow using to_vmx() in common VT code

commit f305fd31f52a8d3ce4d2bf0c88c45bb7a373809c upstream.

Poison to_vmx() in main.c and posted_intr.c so that attempting to interpret
the vCPU as a VMX vCPU will fail at compile time, as opposed to failing at
runtime, or worse corrupting state without outright failing.

Note, to_tdx() is buried in tdx.c, i.e. isn't broadly reachable, and so
doesn't need the same treatment as to_vmx().

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Tested-by: Kai Huang <kai.huang@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260904010353.3175819-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/vmx/main.c
arch/x86/kvm/vmx/posted_intr.c