Commit 0fe3e8d
committed
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>1 parent 16777eb commit 0fe3e8d
1 file changed
Lines changed: 8 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5487 | 5487 | | |
5488 | 5488 | | |
5489 | 5489 | | |
5490 | | - | |
5491 | | - | |
5492 | | - | |
5493 | | - | |
5494 | | - | |
5495 | | - | |
5496 | 5490 | | |
5497 | 5491 | | |
5498 | 5492 | | |
| |||
11579 | 11573 | | |
11580 | 11574 | | |
11581 | 11575 | | |
| 11576 | + | |
| 11577 | + | |
| 11578 | + | |
| 11579 | + | |
| 11580 | + | |
| 11581 | + | |
| 11582 | + | |
| 11583 | + | |
11582 | 11584 | | |
11583 | 11585 | | |
11584 | 11586 | | |
| |||
11927 | 11929 | | |
11928 | 11930 | | |
11929 | 11931 | | |
11930 | | - | |
11931 | | - | |
11932 | | - | |
11933 | | - | |
11934 | | - | |
11935 | | - | |
11936 | | - | |
11937 | | - | |
11938 | | - | |
11939 | | - | |
11940 | 11932 | | |
11941 | 11933 | | |
11942 | 11934 | | |
| |||
0 commit comments