From 9b57c800b79b96769ea3dcd6468578fa664d19f9 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 19 Sep 2023 11:23:34 +0100 Subject: [PATCH] x86/entry: Partially revert IST-exit checks The patch adding check_ist_exit() didn't account for the fact that reset_stack_and_jump() is not an ABI-preserving boundary. The IST-ness in %r12 doesn't survive into the next context, and is a stale value C. This shows up in Gitlab CI for the Clang build: https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/5112783827 and in OSSTest for GCC 8: http://logs.test-lab.xenproject.org/osstest/logs/183045/test-amd64-amd64-xl-qemuu-debianhvm-amd64/serial-pinot0.log There's no straightforward way to reconstruct the IST-exit-ness on the exit-to-guest path after a context switch. For now, we only need IST-exit on the return-to-Xen path. Fixes: 21bdc25b05a0 ("x86/entry: Track the IST-ness of an entry for the exit paths") Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- xen/arch/x86/x86_64/compat/entry.S | 9 +-------- xen/arch/x86/x86_64/entry.S | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S index 7504bfb4f3..bd5abd8040 100644 --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -117,15 +117,8 @@ compat_process_trap: call compat_create_bounce_frame jmp compat_test_all_events -/* %rbx: struct vcpu, %r12: ist_exit, interrupts disabled */ +/* %rbx: struct vcpu, interrupts disabled */ ENTRY(compat_restore_all_guest) - -#ifdef CONFIG_DEBUG - mov %rsp, %rdi - mov %r12, %rsi - call check_ist_exit -#endif - ASSERT_INTERRUPTS_DISABLED mov $~(X86_EFLAGS_IOPL | X86_EFLAGS_VM), %r11d and UREGS_eflags(%rsp),%r11d diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index 988ef6cbc6..5ca74f5f62 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -142,15 +142,8 @@ process_trap: .section .text.entry, "ax", @progbits -/* %rbx: struct vcpu, %r12: ist_exit, interrupts disabled */ +/* %rbx: struct vcpu, interrupts disabled */ restore_all_guest: - -#ifdef CONFIG_DEBUG - mov %rsp, %rdi - mov %r12, %rsi - call check_ist_exit -#endif - ASSERT_INTERRUPTS_DISABLED /* Stash guest SPEC_CTRL value while we can read struct vcpu. */ -- 2.39.5