Re: [PATCH v5 09/26] KVM: nSVM: Call enter_guest_mode() before switching to VMCB02

From: Jim Mattson

Date: Fri Feb 20 2026 - 20:26:51 EST


On Fri, Feb 20, 2026 at 5:13 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> LOL, guess what! Today end's in 'y', which means there's a nSVM bug! It's a
> super minor one though, especially in the broader context, I just happened to
> see it when looking at this patch.
>
> As per 3f6821aa147b ("KVM: x86: Forcibly leave nested if RSM to L2 hits shutdown"),
> shutdown on RSM is suppose to hit L1, not L2. But if enter_svm_guest_mode() fails,
> svm_leave_smm() bails without leaving guest code. Syzkaller probably hasn't found
> the bug because nested_run_pending doesn't get set, but it's still technically
> wrong.

Whoever came up with CONFIG_KVM_SMM was an absolute genius!