KVM: x86: SYSCALL cannot clear eflags[1]
authorNadav Amit <namit@cs.technion.ac.il>
Sun, 2 Nov 2014 09:54:49 +0000 (11:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Nov 2014 14:44:05 +0000 (15:44 +0100)
SYSCALL emulation currently clears in 64-bit mode eflags according to
MSR_SYSCALL_MASK.  However, on bare-metal eflags[1] which is fixed to one
cannot be cleared, even if MSR_SYSCALL_MASK masks the bit.  This wrong behavior
may result in failed VM-entry, as VT disallows entry with eflags[1] cleared.

This patch sets the bit after masking eflags on syscall.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c

index 713295d913fd431eeac5086d9024c9e0f1e869ec..e475cdff15e181d2c1f7664efbd5ce74d75684a4 100644 (file)
@@ -2306,6 +2306,7 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt)
 
                ops->get_msr(ctxt, MSR_SYSCALL_MASK, &msr_data);
                ctxt->eflags &= ~msr_data;
+               ctxt->eflags |= EFLG_RESERVED_ONE_MASK;
 #endif
        } else {
                /* legacy mode */