mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/entry: don't clear DF when raising #UD for lack of syscall handler
While doing so is intentional when invoking the actual callback, to
mimic a hard-coded SYCALL_MASK / FMASK MSR, the same should not be done
when no handler is available and hence #UD is raised.
Fixes: ca6fcf4321 ("x86/pv: Inject #UD for missing SYSCALL callbacks")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
This commit is contained in:
1 parent
17f6d398f7
commit
d2fe9ab304
1 file changed
+11
-1
@@ -38,6 +38,14 @@ FUNC_LOCAL(switch_to_kernel)
|
||||
setc %cl
|
||||
leal (,%rcx,TBF_INTERRUPT),%ecx
|
||||
|
||||
/*
|
||||
* The PV ABI hardcodes the (guest-inaccessible and virtual)
|
||||
* SYSCALL_MASK MSR such that DF (and nothing else) would be cleared.
|
||||
* Note that the equivalent of IF (VGCF_syscall_disables_events) is
|
||||
* dealt with separately above.
|
||||
*/
|
||||
mov $~X86_EFLAGS_DF, %esi
|
||||
|
||||
test %rax, %rax
|
||||
UNLIKELY_START(z, syscall_no_callback) /* TB_eip == 0 => #UD */
|
||||
mov VCPU_trap_ctxt(%rbx), %rdi
|
||||
@@ -47,12 +55,14 @@ UNLIKELY_START(z, syscall_no_callback) /* TB_eip == 0 => #UD */
|
||||
testb $4, X86_EXC_UD * TRAPINFO_sizeof + TRAPINFO_flags(%rdi)
|
||||
setnz %cl
|
||||
lea TBF_EXCEPTION(, %rcx, TBF_INTERRUPT), %ecx
|
||||
or $~0, %esi /* Don't clear DF */
|
||||
UNLIKELY_END(syscall_no_callback)
|
||||
|
||||
movq %rax,TRAPBOUNCE_eip(%rdx)
|
||||
movb %cl,TRAPBOUNCE_flags(%rdx)
|
||||
call create_bounce_frame
|
||||
andl $~X86_EFLAGS_DF,UREGS_eflags(%rsp)
|
||||
/* Conditionally clear DF */
|
||||
and %esi, UREGS_eflags(%rsp)
|
||||
/* %rbx: struct vcpu */
|
||||
test_all_events:
|
||||
ASSERT_NOT_IN_ATOMIC
|
||||
|
||||