linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/entry: fix entry_INT80_compat for Xen PV guests
@ 2022-08-16  7:11 Juergen Gross
  2022-08-16  7:48 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Juergen Gross @ 2022-08-16  7:11 UTC (permalink / raw)
  To: xen-devel, x86, linux-kernel
  Cc: Juergen Gross, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, stable

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: <stable@vger.kernel.org> # 5.19
Fixes: c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/entry/entry_64_compat.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index 682338e7e2a3..4dd19819053a 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -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
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/entry: fix entry_INT80_compat for Xen PV guests
  2022-08-16  7:11 [PATCH] x86/entry: fix entry_INT80_compat for Xen PV guests Juergen Gross
@ 2022-08-16  7:48 ` Jan Beulich
  2022-08-16  8:21 ` [tip: x86/urgent] x86/entry: Fix " tip-bot2 for Juergen Gross
  2022-08-16  9:03 ` [PATCH] x86/entry: fix " Peter Zijlstra
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2022-08-16  7:48 UTC (permalink / raw)
  To: Juergen Gross
  Cc: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, stable, xen-devel, x86,
	linux-kernel

On 16.08.2022 09:11, Juergen Gross wrote:
> 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: <stable@vger.kernel.org> # 5.19
> Fixes: c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: x86/urgent] x86/entry: Fix entry_INT80_compat for Xen PV guests
  2022-08-16  7:11 [PATCH] x86/entry: fix entry_INT80_compat for Xen PV guests Juergen Gross
  2022-08-16  7:48 ` Jan Beulich
@ 2022-08-16  8:21 ` tip-bot2 for Juergen Gross
  2022-08-16  9:03 ` [PATCH] x86/entry: fix " Peter Zijlstra
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Juergen Gross @ 2022-08-16  8:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Juergen Gross, Borislav Petkov, Jan Beulich, stable, x86, linux-kernel

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 <jgross@suse.com>
AuthorDate:    Tue, 16 Aug 2022 09:11:37 +02:00
Committer:     Borislav Petkov <bp@suse.de>
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")
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Cc: <stable@vger.kernel.org> # 5.19
Link: https://lore.kernel.org/r/20220816071137.4893-1-jgross@suse.com
---
 arch/x86/entry/entry_64_compat.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index 682338e..4dd1981 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/entry: fix entry_INT80_compat for Xen PV guests
  2022-08-16  7:11 [PATCH] x86/entry: fix entry_INT80_compat for Xen PV guests Juergen Gross
  2022-08-16  7:48 ` Jan Beulich
  2022-08-16  8:21 ` [tip: x86/urgent] x86/entry: Fix " tip-bot2 for Juergen Gross
@ 2022-08-16  9:03 ` Peter Zijlstra
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2022-08-16  9:03 UTC (permalink / raw)
  To: Juergen Gross
  Cc: xen-devel, x86, linux-kernel, Andy Lutomirski, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	stable

On Tue, Aug 16, 2022 at 09:11:37AM +0200, Juergen Gross wrote:
> 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: <stable@vger.kernel.org> # 5.19
> Fixes: c89191ce67ef ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
> Signed-off-by: Juergen Gross <jgross@suse.com>

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

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>  arch/x86/entry/entry_64_compat.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
> index 682338e7e2a3..4dd19819053a 100644
> --- a/arch/x86/entry/entry_64_compat.S
> +++ b/arch/x86/entry/entry_64_compat.S
> @@ -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
> -- 
> 2.35.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-16 10:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16  7:11 [PATCH] x86/entry: fix entry_INT80_compat for Xen PV guests Juergen Gross
2022-08-16  7:48 ` Jan Beulich
2022-08-16  8:21 ` [tip: x86/urgent] x86/entry: Fix " tip-bot2 for Juergen Gross
2022-08-16  9:03 ` [PATCH] x86/entry: fix " Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).