[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251117101129.GGaRr00XgEln3XzR5N@fat_crate.local>
Date: Mon, 17 Nov 2025 11:11:29 +0100
From: Borislav Petkov <bp@...en8.de>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...nel.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Brendan Jackman <jackmanb@...gle.com>
Subject: Re: [PATCH v5 3/9] x86/bugs: Decouple ALTERNATIVE usage from VERW
macro definition
On Thu, Nov 13, 2025 at 03:37:40PM -0800, Sean Christopherson wrote:
> +#define __CLEAR_CPU_BUFFERS __stringify(VERW)
Let's get rid of one indirection level pls:
diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index 8b4885a1b2ef..59945cb5e5f9 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -309,23 +309,21 @@
* Note: Only the memory operand variant of VERW clears the CPU buffers.
*/
#ifdef CONFIG_X86_64
-#define VERW verw x86_verw_sel(%rip)
+#define VERW __stringify(verw x86_verw_sel(%rip))
#else
/*
* In 32bit mode, the memory operand must be a %cs reference. The data segments
* may not be usable (vm86 mode), and the stack segment may not be flat (ESPFIX32).
*/
-#define VERW verw %cs:x86_verw_sel
+#define VERW __stringify(verw %cs:x86_verw_sel)
#endif
-#define __CLEAR_CPU_BUFFERS __stringify(VERW)
-
/* If necessary, emit VERW on exit-to-userspace to clear CPU buffers. */
#define CLEAR_CPU_BUFFERS \
- ALTERNATIVE "", __CLEAR_CPU_BUFFERS, X86_FEATURE_CLEAR_CPU_BUF
+ ALTERNATIVE "", VERW, X86_FEATURE_CLEAR_CPU_BUF
#define VM_CLEAR_CPU_BUFFERS \
- ALTERNATIVE "", __CLEAR_CPU_BUFFERS, X86_FEATURE_CLEAR_CPU_BUF_VM
+ ALTERNATIVE "", VERW, X86_FEATURE_CLEAR_CPU_BUF_VM
#ifdef CONFIG_X86_64
.macro CLEAR_BRANCH_HISTORY
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists