]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
KVM: x86: emulator injects #DB when RFLAGS.RF is set
authorNadav Amit <namit@cs.technion.ac.il>
Wed, 16 Jul 2014 22:19:31 +0000 (01:19 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 21 Jul 2014 11:43:09 +0000 (13:43 +0200)
If the RFLAGS.RF is set, then no #DB should occur on instruction breakpoints.
However, the KVM emulator injects #DB regardless to RFLAGS.RF. This patch fixes
this behavior. KVM, however, still appears not to update RFLAGS.RF correctly,
regardless of this patch.

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

index 1fd806cb96d4802287ae2a0fdbb1b801a246fe55..cc4f65f39b8753cddc5aa7f0625269f23cc4afad 100644 (file)
@@ -5158,7 +5158,8 @@ static bool kvm_vcpu_check_breakpoint(struct kvm_vcpu *vcpu, int *r)
                }
        }
 
-       if (unlikely(vcpu->arch.dr7 & DR7_BP_EN_MASK)) {
+       if (unlikely(vcpu->arch.dr7 & DR7_BP_EN_MASK) &&
+           !(kvm_get_rflags(vcpu) & X86_EFLAGS_RF)) {
                dr6 = kvm_vcpu_check_hw_bp(eip, 0,
                                           vcpu->arch.dr7,
                                           vcpu->arch.db);