Skip to contentSkip to conversation

x86/pv: Fix the handing of writes to %dr7

PATCH In review Andrew Cooper 2 participants 2 messages Mar 22, 2018 – Mar 23, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: Fix the handing of writes to %dr7

c/s 65e35549 "x86/PV: support data breakpoint extension registers" accidentally broke the handing of writes. The call to activate_debugregs() doesn't write %dr7 as v->arch.debugreg[7] hasn't been updated yet, and the break skips the intended write to %dr7.

Remove the break, causing execution to hit the write_debugreg(7, value); in context at the bottom of the hunk, which in turn causes hardware to be updated appropriately.

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/traps.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
xen/arch/x86/traps.c +1 -4
index 37210da..4bed9de 100644
@@ -2074,14 +2074,11 @@ long set_debugreg(struct vcpu *v, unsigned int reg, unsigned long value)
             /*
              * If DR7 was previously clear then we need to load all other
              * debug registers at this point as they were not restored during
-             * context switch.
+             * context switch.  Updating DR7 itself happens later.
              */
             if ( (v == curr) &&
                  !(v->arch.debugreg[7] & DR7_ACTIVE_MASK) )
-            {
                 activate_debugregs(v);
-                break;
-            }
         }
         if ( v == curr )
             write_debugreg(7, value);
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 22.03.18 at 20:13, <[email protected]> wrote:

c/s 65e35549 "x86/PV: support data breakpoint extension registers" accidentally broke the handing of writes. The call to activate_debugregs() doesn't write %dr7 as v->arch.debugreg[7] hasn't been updated yet, and the break skips the intended write to %dr7.

That's really odd, especially with the comment in activate_debugregs() specifically stating that fact.

Quoted 5 lines

Remove the break, causing execution to hit the write_debugreg(7, value); in context at the bottom of the hunk, which in turn causes hardware to be updated appropriately.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel