public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/entry: Remove UNTRAIN_RET from native_irq_return_ldt
@ 2022-07-13 19:58 Alexandre Chartre
  2022-07-14  9:41 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Chartre @ 2022-07-13 19:58 UTC (permalink / raw)
  To: peterz, bp, x86, linux-kernel
  Cc: konrad.wilk, alexandre.chartre, boris.ostrovsky, ankur.a.arora,
	maciej.szmigiero

UNTRAIN_RET is not needed in native_irq_return_ldt because ret untrain
has already be done at this point. In addition, when the RETBleed
mitigation is IBPB, UNTRAIN_RET clobbers several registers (AX, CX, DX)
so here it trashes user values which are in these registers.

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 285e043a3e40..9953d966d124 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -727,7 +727,6 @@ native_irq_return_ldt:
 	pushq	%rdi				/* Stash user RDI */
 	swapgs					/* to kernel GS */
 	SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi	/* to kernel CR3 */
-	UNTRAIN_RET
 
 	movq	PER_CPU_VAR(espfix_waddr), %rdi
 	movq	%rax, (0*8)(%rdi)		/* user RAX */
-- 
2.31.1


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

end of thread, other threads:[~2022-07-14  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-13 19:58 [PATCH] x86/entry: Remove UNTRAIN_RET from native_irq_return_ldt Alexandre Chartre
2022-07-14  9:41 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox