Skip to content

Commit 7e2c8bc

Browse files
committed
x86/bugs: Reverse instruction order of CLEAR_CPU_BUFFERS
JIRA: https://issues.redhat.com/browse/RHEL-31226 Upstream Status: RHEL only In the CLEAR_CPU_BUFFERS macro, the use of a VERW instruction with %rip relative addressing in the newinstr portion of ALTERNATIVE depends on the presence of commit 270a69c ("x86/alternative: Support relocations in alternatives") and related ones. Break that dependency by reversing the ordering of the two instructions and use ALT_NOT() for the feature flag so that the correct %rip offset will be present without any special handling. This will also allow the RDFS fix to be backported to older RHEL releases without requiring an additional set of x86/alternative commits. Signed-off-by: Waiman Long <longman@redhat.com>
1 parent b25878a commit 7e2c8bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/include/asm/nospec-branch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@
323323
* Note: Only the memory operand variant of VERW clears the CPU buffers.
324324
*/
325325
.macro CLEAR_CPU_BUFFERS
326-
ALTERNATIVE "", __stringify(verw _ASM_RIP(mds_verw_sel)), X86_FEATURE_CLEAR_CPU_BUF
326+
ALTERNATIVE __stringify(verw _ASM_RIP(mds_verw_sel)), "", ALT_NOT(X86_FEATURE_CLEAR_CPU_BUF)
327327
.endm
328328

329329
#else /* __ASSEMBLY__ */

0 commit comments

Comments
 (0)