]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: Move INIT_RECEIVED vs. INIT/SIPI blocked check to KVM_RUN
authorSean Christopherson <seanjc@google.com>
Thu, 5 Jun 2025 19:50:17 +0000 (12:50 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 20 Jun 2025 20:08:00 +0000 (13:08 -0700)
commit0fe3e8d804fdcc09ef44fbffcad8c39261a03470
treefcae0f443d099d7b957dd9c76cb7174f58849f31
parent16777ebded414bbf5c351343e25b98da74bb48c2
KVM: x86: Move INIT_RECEIVED vs. INIT/SIPI blocked check to KVM_RUN

Check for the should-be-impossible scenario of a vCPU being in
Wait-For-SIPI with INIT/SIPI blocked during KVM_RUN instead of trying to
detect and prevent illegal combinations in every ioctl that sets relevant
state.  Attempting to handle every possible "set" path is a losing game of
whack-a-mole, and risks breaking userspace.  E.g. INIT/SIPI are blocked on
Intel if the vCPU is in VMX Root mode (post-VMXON), and on AMD if GIF=0.
Handling those scenarios would require potentially breaking changes to
{vmx,svm}_set_nested_state().

Moving the check to KVM_RUN fixes a syzkaller-induced splat due to the
aforementioned VMXON case, and in theory should close the hole once and for
all.

Note, kvm_x86_vcpu_pre_run() already handles SIPI_RECEIVED, only the WFS
case needs additional attention.

Reported-by: syzbot+c1cbaedc2613058d5194@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?id=490ae63d8d89cb82c5d462d16962cf371df0e476
Link: https://lore.kernel.org/r/20250605195018.539901-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c