Re: [PATCH v7 1/6] x86/bugs: Add asm helpers for executing VERW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 09, 2024 at 11:06:02AM -0800, Pawan Gupta wrote:
> (Though, there was a comment on avoiding the macro alltogether, to which
> I replied that it complicates 32-bit.)

Hmm, so this seems to build the respective entry_{32,64}.S TUs fine:

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

and looking at the asm:

64-bit:

# 317 "./arch/x86/include/asm/nospec-branch.h"
.macro CLEAR_CPU_BUFFERS
 ALTERNATIVE "", "verw mds_verw_sel (% rip)", ( 3*32+18)
.endm

  23:   0f 00 2d 00 00 00 00    verw   0x0(%rip)        # 2a <.altinstr_replacement+0x2a>

32-bit:

.macro CLEAR_CPU_BUFFERS
 ALTERNATIVE "", "verw mds_verw_sel", ( 3*32+18)
.endm

 13d:   0f 00 2d 00 00 00 00    verw   0x0

it makes sense.

So what complications do you mean?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux