x86/traps: Fix error handling of the pv %dr7 shadow state
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 1 Jun 2018 13:08:59 +0000 (14:08 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 4 Jun 2018 10:05:45 +0000 (11:05 +0100)
commit237c31b5a1d5aa88cdb59b8c31b1b62eb13e82d1
tree6c53d829461eb31ecb3d59e9f1983c643f6be07f
parent06f542f8f2e446c01bd0edab51e9450af7f6e05b
x86/traps: Fix error handling of the pv %dr7 shadow state

c/s "x86/pv: Introduce and use x86emul_write_dr()" fixed a bug with IO shadow
handling, in that it remained stale and visible until %dr7.L/G got set again.

However, it neglected the -EPERM return inbetween these two hunks, introducing
a different bug in which a write to %dr7 which tries to set IO breakpoints
without %cr4.DE being set clobbers the IO state, rather than leaves it alone.

Instead, move the zeroing slightly later, which guarentees that the shadow
gets written exactly once, on a successful update to %dr7.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/traps.c