Re: [tip: x86/urgent] x86/bugs: Use code segment selector for VERW operand

From: Borislav Petkov
Date: Wed Oct 09 2024 - 02:11:35 EST


On Tue, Oct 08, 2024 at 10:45:36PM -0000, tip-bot2 for Pawan Gupta wrote:
> .macro CLEAR_CPU_BUFFERS
> - ALTERNATIVE "", __stringify(verw _ASM_RIP(mds_verw_sel)), X86_FEATURE_CLEAR_CPU_BUF
> +#ifdef CONFIG_X86_64
> + ALTERNATIVE "", "verw mds_verw_sel(%rip)", X86_FEATURE_CLEAR_CPU_BUF
> +#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).
> + */
> + ALTERNATIVE "", "verw %cs:mds_verw_sel", X86_FEATURE_CLEAR_CPU_BUF
> +#endif

So why didn't we ifdef the "verw mds_verw_sel(%rip)" and "verw
%cs:mds_verw_sel" macro argument instead of adding more bigger ugly ifdeffery?

--
Regards/Gruss,
Boris.

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