Skip to contentSkip to conversation

x86/entry: fix entry_INT80_compat for Xen PV guests

PATCH Applied Juergen Gross 4 participants 4 messages Aug 16, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/entry: fix entry_INT80_compat for Xen PV guests

Commit c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS") missed one use case of SWAPGS in entry_INT80_compat. Removing of the SWAPGS macro led to asm just using "swapgs", as it is accepting instructions in capital letters, too.

This in turn leads to splats in Xen PV guests like:

[   36.145223] general protection fault, maybe for address 0x2d: 0000 [#1] PREEMPT SMP NOPTI
[   36.145794] CPU: 2 PID: 1847 Comm: ld-linux.so.2 Not tainted 5.19.1-1-default #1 openSUSE Tumbleweed f3b44bfb672cdb9f235aff53b57724eba8b9411b
[   36.146608] Hardware name: HP ProLiant ML350p Gen8, BIOS P72 11/14/2013
[   36.148126] RIP: e030:entry_INT80_compat+0x3/0xa3

Fix that by open coding this single instance of the SWAPGS macro.

Cc <[email protected]> # 5.19
Fixes c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
---
 arch/x86/entry/entry_64_compat.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry_64_compat.S +1 -1
index 682338e7e2a3..4dd19819053a 100644
@@ -311,7 +311,7 @@ SYM_CODE_START(entry_INT80_compat)
 	 * Interrupts are off on entry.
 	 */
 	ASM_CLAC			/* Do this early to minimize exposure */
-	SWAPGS
+	ALTERNATIVE "swapgs", "", X86_FEATURE_XENPV
 
 	/*
 	 * User tracing code (ptrace or signal handlers) might assume that
Signature · 1 line
2.35.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Juergen Gross

Commit c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS") missed one use case of SWAPGS in entry_INT80_compat. Removing of the SWAPGS macro led to asm just using "swapgs", as it is accepting instructions in capital letters, too.

This in turn leads to splats in Xen PV guests like:

[   36.145223] general protection fault, maybe for address 0x2d: 0000 [#1] PREEMPT SMP NOPTI
[   36.145794] CPU: 2 PID: 1847 Comm: ld-linux.so.2 Not tainted 5.19.1-1-default #1 openSUSE Tumbleweed f3b44bfb672cdb9f235aff53b57724eba8b9411b
[   36.146608] Hardware name: HP ProLiant ML350p Gen8, BIOS P72 11/14/2013
[   36.148126] RIP: e030:entry_INT80_compat+0x3/0xa3
Quoted 5 lines

Fix that by open coding this single instance of the SWAPGS macro.

Cc <[email protected]> # 5.19
Fixes c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
Acked-by on v1 1/1
#2 lore raw
In reply to Juergen Gross
Quoted 13 lines · Juergen Gross

Commit c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS") missed one use case of SWAPGS in entry_INT80_compat. Removing of the SWAPGS macro led to asm just using "swapgs", as it is accepting instructions in capital letters, too.

This in turn leads to splats in Xen PV guests like:

[   36.145223] general protection fault, maybe for address 0x2d: 0000 [#1] PREEMPT SMP NOPTI
[   36.145794] CPU: 2 PID: 1847 Comm: ld-linux.so.2 Not tainted 5.19.1-1-default #1 openSUSE Tumbleweed f3b44bfb672cdb9f235aff53b57724eba8b9411b
[   36.146608] Hardware name: HP ProLiant ML350p Gen8, BIOS P72 11/14/2013
[   36.148126] RIP: e030:entry_INT80_compat+0x3/0xa3
Quoted 5 lines

Fix that by open coding this single instance of the SWAPGS macro.

Cc <[email protected]> # 5.19
Fixes c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")

It's a little unfortunate int80 is different from the other compat entry points, but that's life I suppose.

Quoted 20 lines
---
 arch/x86/entry/entry_64_compat.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry_64_compat.S +1 -1
index 682338e7e2a3..4dd19819053a 100644
@@ -311,7 +311,7 @@ SYM_CODE_START(entry_INT80_compat)
 	 * Interrupts are off on entry.
 	 */
 	ASM_CLAC			/* Do this early to minimize exposure */
-	SWAPGS
+	ALTERNATIVE "swapgs", "", X86_FEATURE_XENPV
 
 	/*
 	 * User tracing code (ptrace or signal handlers) might assume that
Signature · 1 line
2.35.3
merge bot Applied
#3 lore raw

[tip: x86/urgent] x86/entry: Fix entry_INT80_compat for Xen PV guests

In reply to Juergen Gross
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     5b9f0c4df1c1152403c738373fb063e9ffdac0a1
Gitweb:        https://git.kernel.org/tip/5b9f0c4df1c1152403c738373fb063e9ffdac0a1
Author:        Juergen Gross <[email protected]>
AuthorDate:    Tue, 16 Aug 2022 09:11:37 +02:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Tue, 16 Aug 2022 10:02:52 +02:00

x86/entry: Fix entry_INT80_compat for Xen PV guests

Commit

c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")

missed one use case of SWAPGS in entry_INT80_compat(). Removing of the SWAPGS macro led to asm just using "swapgs", as it is accepting instructions in capital letters, too.

This in turn leads to splats in Xen PV guests like:

  [   36.145223] general protection fault, maybe for address 0x2d: 0000 [#1] PREEMPT SMP NOPTI
  [   36.145794] CPU: 2 PID: 1847 Comm: ld-linux.so.2 Not tainted 5.19.1-1-default #1 \
	  openSUSE Tumbleweed f3b44bfb672cdb9f235aff53b57724eba8b9411b
  [   36.146608] Hardware name: HP ProLiant ML350p Gen8, BIOS P72 11/14/2013
  [   36.148126] RIP: e030:entry_INT80_compat+0x3/0xa3

Fix that by open coding this single instance of the SWAPGS macro.

Fixes c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
Cc <[email protected]> # 5.19
---
 arch/x86/entry/entry_64_compat.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry_64_compat.S +1 -1
index 682338e..4dd1981 100644
@@ -311,7 +311,7 @@ SYM_CODE_START(entry_INT80_compat)
 	 * Interrupts are off on entry.
 	 */
 	ASM_CLAC			/* Do this early to minimize exposure */
-	SWAPGS
+	ALTERNATIVE "swapgs", "", X86_FEATURE_XENPV
 
 	/*
 	 * User tracing code (ptrace or signal handlers) might assume that