Re: [PATCH V6 6/8] x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS

From: Borislav Petkov
Date: Mon May 02 2022 - 13:56:28 EST


On Mon, May 02, 2022 at 02:18:35PM +0200, Juergen Gross wrote:
> The syscall will land in the hypervisor, which then will activate
> the related registered callback (xen_sysenter_target).

Aha, that would do a bit of a fixup and then go to the common label
entry_SYSENTER_compat_after_hwframe.

We probably should document this so that it is clear what uses those...

---
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 9da5eef9affe..93065c4914ad 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -103,6 +103,11 @@ SYM_INNER_LABEL(entry_SYSCALL_64_safe_stack, SYM_L_GLOBAL)
pushq %r11 /* pt_regs->flags */
pushq $__USER_CS /* pt_regs->cs */
pushq %rcx /* pt_regs->ip */
+
+ /*
+ * XENPV jumps here after frame fixup in the respective entry points in
+ * ...xen-asm.S.
+ */
SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL)
pushq %rax /* pt_regs->orig_ax */

diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index c5aeb0819707..b473f8e17afc 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -71,6 +71,11 @@ SYM_CODE_START(entry_SYSENTER_compat)
pushfq /* pt_regs->flags (except IF = 0) */
pushq $__USER32_CS /* pt_regs->cs */
pushq $0 /* pt_regs->ip = 0 (placeholder) */
+
+ /*
+ * XENPV jumps here after frame fixup in the respective entry points in
+ * ...xen-asm.S.
+ */
SYM_INNER_LABEL(entry_SYSENTER_compat_after_hwframe, SYM_L_GLOBAL)

/*

> I wouldn't insist on the CONFIG_DEBUG_ENTRY chunk.

Ok, simpler asm, cool, let's do it then.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette