]> xenbits.xensource.com Git - xen.git/commit
x86/pv: Don't clobber NT on return-to-guest
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 29 Jun 2020 10:32:37 +0000 (11:32 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 24 Sep 2020 20:02:35 +0000 (21:02 +0100)
commit5bcac985498ed83d89666959175ca9c9ed561ae1
tree25223e0982c05dab46f472a6c4e9445f4c4a5f71
parent61d4a04349895edc5a5868274b906ba61ef24f47
x86/pv: Don't clobber NT on return-to-guest

A 64bit IRET can restore NT - the faulting case is when NT is set in the live
flags.  This change had an unintended consequence of causing the NT flag to
spontaneously disappear from guest context whenever a interrupt/exception
occurred.

In combination with a SYSENTER which sets both TF and NT, Xen's handling of
the #DB exceptions clears NT before it is even recorded suitably in the guest
kernel's view of what userspace was doing.

Reported-by: Andy Lutomirski <luto@kernel.org>
Fixes: 0e47f92b0 ("x86: force EFLAGS.IF on when exiting to PV guests")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/x86_64/compat/entry.S
xen/arch/x86/x86_64/entry.S