linux/arch/x86/include/uapi/asm
Sean Christopherson 9d7dfb95da KVM: VMX: Inject #UD if guest tries to execute SEAMCALL or TDCALL
Add VMX exit handlers for SEAMCALL and TDCALL to inject a #UD if a non-TD
guest attempts to execute SEAMCALL or TDCALL.  Neither SEAMCALL nor TDCALL
is gated by any software enablement other than VMXON, and so will generate
a VM-Exit instead of e.g. a native #UD when executed from the guest kernel.

Note!  No unprivileged DoS of the L1 kernel is possible as TDCALL and
SEAMCALL #GP at CPL > 0, and the CPL check is performed prior to the VMX
non-root (VM-Exit) check, i.e. userspace can't crash the VM. And for a
nested guest, KVM forwards unknown exits to L1, i.e. an L2 kernel can
crash itself, but not L1.

Note #2!  The Intel® Trust Domain CPU Architectural Extensions spec's
pseudocode shows the CPL > 0 check for SEAMCALL coming _after_ the VM-Exit,
but that appears to be a documentation bug (likely because the CPL > 0
check was incorrectly bundled with other lower-priority #GP checks).
Testing on SPR and EMR shows that the CPL > 0 check is performed before
the VMX non-root check, i.e. SEAMCALL #GPs when executed in usermode.

Note #3!  The aforementioned Trust Domain spec uses confusing pseudocode
that says that SEAMCALL will #UD if executed "inSEAM", but "inSEAM"
specifically means in SEAM Root Mode, i.e. in the TDX-Module.  The long-
form description explicitly states that SEAMCALL generates an exit when
executed in "SEAM VMX non-root operation".  But that's a moot point as the
TDX-Module injects #UD if the guest attempts to execute SEAMCALL, as
documented in the "Unconditionally Blocked Instructions" section of the
TDX-Module base specification.

Cc: stable@vger.kernel.org
Cc: Kai Huang <kai.huang@intel.com>
Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20251016182148.69085-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
2025-10-20 09:37:04 -07:00
..
Kbuild
a.out.h
amd_hsmp.h platform/x86/amd/hsmp: Add support for HSMP protocol version 7 messages 2024-12-02 19:20:14 +02:00
auxvec.h
bitsperlong.h
boot.h
bootparam.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
byteorder.h
debugreg.h x86/traps: Initialize DR6 by writing its architectural reset value 2025-06-24 13:15:51 -07:00
e820.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
elf.h x86/elf: Add a new FPU buffer layout info to x86 core files 2024-07-29 10:45:43 +02:00
hw_breakpoint.h
hwcap2.h
ist.h
kvm.h KVM: x86: Define AMD's #HV, #VC, and #SX exception vectors 2025-09-23 09:29:03 -07:00
kvm_para.h
kvm_perf.h
ldt.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
mce.h x86/MCE/AMD: Add support for new MCA_SYND{1,2} registers 2024-10-31 10:36:07 +01:00
mman.h mman: Add map_shadow_stack() flags 2024-10-04 12:04:33 +01:00
msgbuf.h
msr.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
mtrr.h
perf_regs.h
posix_types.h
posix_types_32.h
posix_types_64.h
posix_types_x32.h
prctl.h
processor-flags.h
ptrace-abi.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
ptrace.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
sembuf.h
setup.h
setup_data.h x86/kexec: add support for passing kexec handover (KHO) data 2025-05-12 23:50:41 -07:00
sgx.h
shmbuf.h
sigcontext.h
sigcontext32.h
siginfo.h
signal.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
stat.h
statfs.h
svm.h x86/apic: Initialize Secure AVIC APIC backing page 2025-08-31 21:59:07 +02:00
swab.h
ucontext.h
unistd.h
vm86.h
vmx.h KVM: VMX: Inject #UD if guest tries to execute SEAMCALL or TDCALL 2025-10-20 09:37:04 -07:00
vsyscall.h