x86: extend coverage of -mlfence-after-load
Expands the set of instructions that trigger -mlfence-after-load to include more loads that affect EFLAGS or subsequent memory accesses.
This patch extends the coverage of the -mlfence-after-load option by identifying and including more x86 instructions that require an LFENCE to mitigate speculative execution vulnerabilities. Instructions like LLDT, VERR/VERW, BT variants, SHLD/SHRD, ARPL, CMPXCHG, and VMX instructions are now considered, ensuring broader protection.
In Details
This patch modifies the load_insn_p function in tc-i386.c to include a wider range of instructions that should trigger an LFENCE insertion when -mlfence-after-load is enabled. It adds specific handling for instructions that read from memory and potentially affect EFLAGS or subsequent memory operations, such as LLDT, VERR/VERW, BT variants, SHLD/SHRD, ARPL, CMPXCHG, and certain VMX instructions.
- x86
- A family of instruction set architectures (ISAs) for CPUs, commonly used in personal computers and servers.
- -mlfence-after-load
- An assembler option that controls the insertion of an LFENCE (load fence) instruction after certain load operations.
- LFENCE
- A processor instruction that orders memory loads, preventing subsequent loads from being reordered before it.
- EFLAGS
- A special register in x86 architecture that stores status flags and control bits, modified by many instructions.
- memory operand
- An operand in an instruction that refers to a location in memory.
- VMX
- Virtual Machine Extensions, a set of Intel processor features for supporting virtualization.