[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.3] x86/vmx: Fix injection of #DB traps following XSA-156
commit ac0cc84d7bdfc111d47236356e5d06b5681a1dd6 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Jan 20 14:20:57 2016 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Jan 20 14:20:57 2016 +0100 x86/vmx: Fix injection of #DB traps following XSA-156 Most #DB exceptions are traps rather than faults, meaning that the instruction pointer in the exception frame points after the instruction rather than at it. However, VMX intercepts all have fault semantics, even when intercepting a trap. Re-injecting an intercepted trap as a fault causes an infinite loop in the guest, by re-executing the same trapping instruction repeatedly. This breaks debugging inside the guest. Introduce a helper which copies VM_EXIT_INTR_INTO to VM_ENTRY_INTR_INFO, and use it to mirror the intercepted interrupt back to the guest. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx> master commit: 0747bc8b4d85f3fc0ee1e58418418fa0229e8ff8 master date: 2016-01-05 11:28:56 +0000 --- xen/arch/x86/hvm/vmx/vmx.c | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 72c823e..25ae750 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2414,6 +2414,28 @@ static int vmx_handle_eoi_write(void) return 0; } +/* + * Propagate VM_EXIT_INTR_INFO to VM_ENTRY_INTR_INFO. Used to mirror an + * intercepted exception back to the guest as if Xen hadn't intercepted it. + * + * It is the callers responsibility to ensure that this function is only used + * in the context of an appropriate vmexit. + */ +static void vmx_propagate_intr(void) +{ + unsigned long intr = __vmread(VM_EXIT_INTR_INFO); + + ASSERT(intr & INTR_INFO_VALID_MASK); + + __vmwrite(VM_ENTRY_INTR_INFO, intr); + + if ( intr & INTR_INFO_DELIVER_CODE_MASK ) + __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, + __vmread(VM_EXIT_INTR_ERROR_CODE)); + + __vmwrite(VM_ENTRY_INSTRUCTION_LEN, __vmread(VM_EXIT_INSTRUCTION_LEN)); +} + static void vmx_idtv_reinject(unsigned long idtv_info) { @@ -2611,7 +2633,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) HVMTRACE_1D(TRAP_DEBUG, exit_qualification); write_debugreg(6, exit_qualification | 0xffff0ff0); if ( !v->domain->debugger_attached ) - hvm_inject_hw_exception(vector, HVM_DELIVER_NO_ERROR_CODE); + vmx_propagate_intr(); else domain_pause_for_debugger(); break; @@ -2676,8 +2698,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) break; case TRAP_alignment_check: HVMTRACE_1D(TRAP, vector); - hvm_inject_hw_exception(vector, - __vmread(VM_EXIT_INTR_ERROR_CODE)); + vmx_propagate_intr(); break; case TRAP_nmi: if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) != -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.3 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |