Skip to content

Commit 0e3b70a

Browse files
committed
KVM: x86: Document an erratum in KVM_SET_VCPU_EVENTS on Intel CPUs
Document a flaw in KVM's ABI which lets userspace attempt to inject a "bad" hardware exception event, and thus induce VM-Fail on Intel CPUs. Fixing the flaw is a fool's errand, as AMD doesn't sanity check the validity of the error code, Intel CPUs that support CET relax the check for Protected Mode, userspace can change the mode after queueing an exception, KVM ignores the error code when emulating Real Mode exceptions, and so on and so forth. The VM-Fail itself doesn't harm KVM or the kernel beyond triggering a ratelimited pr_warn(), so just document the oddity. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 90a8772 commit 0e3b70a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Documentation/virt/kvm/x86/errata.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ Note however that any software (e.g ``WIN87EM.DLL``) expecting these features
3333
to be present likely predates these CPUID feature bits, and therefore
3434
doesn't know to check for them anyway.
3535

36+
``KVM_SET_VCPU_EVENTS`` issue
37+
-----------------------------
38+
39+
Invalid KVM_SET_VCPU_EVENTS input with respect to error codes *may* result in
40+
failed VM-Entry on Intel CPUs. Pre-CET Intel CPUs require that exception
41+
injection through the VMCS correctly set the "error code valid" flag, e.g.
42+
require the flag be set when injecting a #GP, clear when injecting a #UD,
43+
clear when injecting a soft exception, etc. Intel CPUs that enumerate
44+
IA32_VMX_BASIC[56] as '1' relax VMX's consistency checks, and AMD CPUs have no
45+
restrictions whatsoever. KVM_SET_VCPU_EVENTS doesn't sanity check the vector
46+
versus "has_error_code", i.e. KVM's ABI follows AMD behavior.
47+
3648
Nested virtualization features
3749
------------------------------
3850

0 commit comments

Comments
 (0)