File 5b508ce8-VMX-dont-clobber-dr6-while-debug-state-is-lazy.patch of Package xen.10697
# Commit 3cdac2805692c7accde2f405d81cc0be799aee48
# Date 2018-07-19 14:06:48 +0100
# Author Andrew Cooper <andrew.cooper3@citrix.com>
# Committer Andrew Cooper <andrew.cooper3@citrix.com>
x86/vmx: Don't clobber %dr6 while debugging state is lazy
c/s 4f36452b63 introduced a write to %dr6 in the #DB intercept case, but the
guests debug registers may be lazy at this point, at which point the guests
later attempt to read %dr6 will discard this value and use the older stale
value.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2849,6 +2849,7 @@ void vmx_vmexit_handler(struct cpu_user_
*/
__vmread(EXIT_QUALIFICATION, &exit_qualification);
HVMTRACE_1D(TRAP_DEBUG, exit_qualification);
+ __restore_debug_registers(v);
write_debugreg(6, exit_qualification | 0xffff0ff0);
if ( !v->domain->debugger_attached )
vmx_propagate_intr(intr_info);