]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: nSVM: Raise #UD if unhandled VMMCALL isn't intercepted by L1
authorKevin Cheng <chengkev@google.com>
Wed, 4 Mar 2026 00:22:22 +0000 (16:22 -0800)
committerSean Christopherson <seanjc@google.com>
Thu, 5 Mar 2026 00:08:55 +0000 (16:08 -0800)
commitc36991c6f8d2ab56ee67aff04e3c357f45cfc76c
tree63701bd663b0833e668b2d4d2ec080d320fcb05c
parentd5bde6113aed8315a2bfe708730b721be9c2f48b
KVM: nSVM: Raise #UD if unhandled VMMCALL isn't intercepted by L1

Explicitly synthesize a #UD for VMMCALL if L2 is active, L1 does NOT want
to intercept VMMCALL, nested_svm_l2_tlb_flush_enabled() is true, and the
hypercall is something other than one of the supported Hyper-V hypercalls.
When all of the above conditions are met, KVM will intercept VMMCALL but
never forward it to L1, i.e. will let L2 make hypercalls as if it were L1.

The TLFS says a whole lot of nothing about this scenario, so go with the
architectural behavior, which says that VMMCALL #UDs if it's not
intercepted.

Opportunistically do a 2-for-1 stub trade by stub-ifying the new API
instead of the helpers it uses.  The last remaining "single" stub will
soon be dropped as well.

Suggested-by: Sean Christopherson <seanjc@google.com>
Fixes: 3f4a812edf5c ("KVM: nSVM: hyper-v: Enable L2 TLB flush")
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Kevin Cheng <chengkev@google.com>
Link: https://patch.msgid.link/20260228033328.2285047-5-chengkev@google.com
[sean: rewrite changelog and comment, tag for stable, remove defunct stubs]
Reviewed-by: Yosry Ahmed <yosry@kernel.org>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Link: https://patch.msgid.link/20260304002223.1105129-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/hyperv.h
arch/x86/kvm/svm/hyperv.h
arch/x86/kvm/svm/nested.c
arch/x86/kvm/svm/svm.c