mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/bugs: Use fixed addressing for VERW operand
@ 2024-02-26 23:52 Pawan Gupta
  2024-02-27  8:47 ` Nikolay Borisov
  2024-02-29  2:03 ` Pawan Gupta
  0 siblings, 2 replies; 8+ messages in thread
From: Pawan Gupta @ 2024-02-26 23:52 UTC (permalink / raw)
  To: Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Josh Poimboeuf,
	Ingo Molnar, Dave Hansen, x86, H. Peter Anvin
  Cc: Daniel Sneddon, Nikolay Borisov, linux-kernel, Pawan Gupta

Macro used for MDS mitigation executes VERW with relative addressing for
the operand. This is unnecessary and creates a problem for backports on
older kernels that don't support relocations in alternatives. Relocation
support was added by commit 270a69c4485d ("x86/alternative: Support
relocations in alternatives"). Also asm for fixed addressing is much
more cleaner than relative RIP addressing.

Simplify the asm by using fixed addressing for VERW operand.

Fixes: baf8361e5455 ("x86/bugs: Add asm helpers for executing VERW")
Reported-by: Nikolay Borisov <nik.borisov@suse.com>
Closes: https://lore.kernel.org/lkml/20558f89-299b-472e-9a96-171403a83bd6@suse.com/
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
---
 arch/x86/include/asm/nospec-branch.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index 2aa52cab1e46..ab19c7f1167b 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -323,7 +323,7 @@
  * Note: Only the memory operand variant of VERW clears the CPU buffers.
  */
 .macro CLEAR_CPU_BUFFERS
-	ALTERNATIVE "", __stringify(verw _ASM_RIP(mds_verw_sel)), X86_FEATURE_CLEAR_CPU_BUF
+	ALTERNATIVE "", __stringify(verw mds_verw_sel), X86_FEATURE_CLEAR_CPU_BUF
 .endm
 
 #else /* __ASSEMBLY__ */

---
base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b
change-id: 20240226-verw-arg-fix-796a63088c4d


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

end of thread, other threads:[~2024-02-29  9:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-26 23:52 [PATCH] x86/bugs: Use fixed addressing for VERW operand Pawan Gupta
2024-02-27  8:47 ` Nikolay Borisov
2024-02-27  9:43   ` Jiri Slaby
2024-02-29  1:39     ` Pawan Gupta
2024-02-29  9:14       ` Pawan Gupta
2024-02-29  9:19         ` Jiri Slaby
2024-02-29  9:34           ` Pawan Gupta
2024-02-29  2:03 ` Pawan Gupta

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

all inboxes | Powered by JetHome®