diff mbox

[v2,5/8] Revert "kvm: nVMX: Disallow userspace-injected exceptions in guest mode"

Message ID 1511278211-12257-6-git-send-email-liran.alon@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liran Alon Nov. 21, 2017, 3:30 p.m. UTC
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@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@orcle.com>
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@orcle.com>
---
 arch/x86/kvm/x86.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox

Patch

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 */