Re: [PATCH] KVM: x86: Defer non-architectural deliver of exception payload to userspace read

From: Sean Christopherson

Date: Thu Mar 05 2026 - 12:17:27 EST


On Tue, 17 Feb 2026 16:54:38 -0800, Sean Christopherson wrote:
> When attempting to play nice with userspace that hasn't enabled
> KVM_CAP_EXCEPTION_PAYLOAD, defer KVM's non-architectural delivery of the
> payload until userspace actually reads relevant vCPU state, and more
> importantly, force delivery of the payload in *all* paths where userspace
> saves relevant vCPU state, not just KVM_GET_VCPU_EVENTS.
>
> Ignoring userspace save/restore for the moment, delivering the payload
> before the exception is injected is wrong regardless of whether L1 or L2
> is running. To make matters even more confusing, the flaw *currently*
> being papered over by the !is_guest_mode() check isn't even the same bug
> that commit da998b46d244 ("kvm: x86: Defer setting of CR2 until #PF
> delivery") was trying to avoid.
>
> [...]

Applied to kvm-x86 nested, thanks!

[1/1] KVM: x86: Defer non-architectural deliver of exception payload to userspace read
https://github.com/kvm-x86/linux/commit/d0ad1b05bbe6

--
https://github.com/kvm-x86/linux/tree/next