KVM: vmx: Advance rip to after an ICEBP instruction.
PATCH 1/1 KVM: vmx: Advance rip to after an ICEBP instruction.
When entering an exception after an ICEBP, the saved instruction pointer should point to after the instruction.
This fixes the bug here: https://bugs.launchpad.net/qemu/+bug/1119686
Signed-off-by Huw Davies <[email protected]>
--- arch/x86/kvm/vmx.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +3 -0
@@ -4841,6 +4841,9 @@ static int handle_exception(struct kvm_vcpu *vcpu) (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) { vcpu->arch.dr6 &= ~15 ; vcpu->arch.dr6 |= dr6; +if (dr6 ==0 )/* icebp */ +skip_emulated_instruction (vcpu); +kvm_queue_exception (vcpu,DB_VECTOR );return 1 ; }
Signature · 1 line
1.8.0
Quoted 15 lines · Huw Davies
When entering an exception after an ICEBP, the saved instruction pointer should point to after the instruction.
This fixes the bug here: https://bugs.launchpad.net/qemu/+bug/1119686
Signed-off-by Huw Davies <[email protected]>--- arch/x86/kvm/vmx.c | 3 +++ 1 file changed, 3 insertions(+)arch/x86/kvm/vmx.c +0
-0
arch/x86/kvm/vmx.c static int handle_exception(struct kvm_vcpu *vcpu) · line 4844
Quoted 4 lines
arch/x86/kvm/vmx.c +1
-0@@ -4841,6 +4841,9 @@ static int handle_exception(struct kvm_vcpu *vcpu) (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) { vcpu->arch.dr6 &= ~15 ; vcpu->arch.dr6 |= dr6; +if (dr6 ==0 )/* icebp */
In arch/x86/kernel/traps.c, DR6_RESERVED is first masked out before testing the result against 0 - that's probably more robust here, too.
Jan
Quoted 6 lines
arch/x86/kvm/vmx.c +2
-0+skip_emulated_instruction (vcpu); +kvm_queue_exception (vcpu,DB_VECTOR );return 1 ; }
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux