On Thu, Aug 29, 2024 at 03:28:13PM -0700, Dave Hansen wrote:
On 7/11/24 15:03, Pawan Gupta wrote:
+/*
- Safer version of CLEAR_CPU_BUFFERS that uses %ss to reference VERW operand
- mds_verw_sel. This ensures VERW will not #GP for an arbitrary user %ds.
- */
+.macro CLEAR_CPU_BUFFERS_SAFE
- ALTERNATIVE "", __stringify(verw %ss:_ASM_RIP(mds_verw_sel)), X86_FEATURE_CLEAR_CPU_BUF
+.endm
One other thing...
Instead of making a "_SAFE" variant, let's just make the 32-bit version always safe.
That sounds good to me.
Also, is there any downside to using %ss: on 64-bit? If not, let's just update the one and only CLEAR_CPU_BUFFERS use %ss:.
A quick test after adding %ss: on 64-bit doesn't show any significant latency difference. I will revise the patch.