The reverted commit seems to assume that userspace-injected exceptions are in "pending" state and not in "injected" state. However, they should be treated as in "injected" state. Therefore, their side-effects should be assumed to have already taken place. This is aligned with how userspace-injected interrupts are handled in same ioctl. Because the userspace-injected exceptions should be treated in "injected" state, they cannot be intercepted by L1 when running in L2 and therefore none of the cases the reverted commit mentiones applies. Signed-off-by: Liran Alon <liran.alon@xxxxxxxxxx> Reviewed-by: Nikita Leshenko <nikita.leshchenko@xxxxxxxxxx> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxx> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxx> --- arch/x86/kvm/x86.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c8cec7c39c1c..f4a623ba087e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3142,8 +3142,7 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, return -EINVAL; if (events->exception.injected && - (events->exception.nr > 31 || events->exception.nr == NMI_VECTOR || - is_guest_mode(vcpu))) + (events->exception.nr > 31 || events->exception.nr == NMI_VECTOR)) return -EINVAL; /* INITs are latched while in SMM */ -- 1.9.1