Gather instructions could lead to security issues, details please refer to https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/gather-data-sampling.html.
This supported options -mno-gather and -mno-scatter, which could avoid generating gather/scatter instructions in backend except using intrinsics or inline asms.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
60,030 ms | x64 debian > MLIR.Examples/standalone::test.toy |
Event Timeline
clang/lib/Driver/ToolChains/Clang.cpp | ||
---|---|---|
7527 ↗ | (On Diff #549268) | Put these in clang/lib/Driver/ToolChains/Arch/X86.cpp:getX86TargetFeatures? They are target-specific. |
clang/include/clang/Driver/Options.td | ||
---|---|---|
903–906 | Also remove NoXarchOption https://maskray.me/blog/2021-03-28-compiler-driver-and-cross-compilation#misc If an option has the NoXarchOption flag, ClangDriver will emit an error if the option is used after -Xarch_* (originally for universal macOS binary, reused by offloading purposes -Xarch_host/etc). The error checking only applies to a small set of options (e.g. -o) and is not very useful for most options, but NoXarchOption was improperly named DriverOption (commit aabb0b11a3c1d8a6bb859db80400cffdcc9b336f) and lured some contributors to add NoXarchOption to options that should not have the flag. |
llvm/lib/Target/X86/X86.td | ||
---|---|---|
437 | Does "Prefer no gather instructions" sound better? I think these two should be put under "X86 Subtarget Tuning features"? |
llvm/lib/Target/X86/X86.td | ||
---|---|---|
437 | I think the two options are to mitigate security issues. Could refer to link in summary. |
llvm/lib/Target/X86/X86.td | ||
---|---|---|
437 | It depends on if the micro code was applied. We should assume user care of this option should have applied the micro code. So it's more like a performance turning rather than mitigation. And you cannot disable all gather/scatter instructions with these options. |
llvm/lib/Target/X86/X86.td | ||
---|---|---|
437 | Micro code applied? You mean we should keep eye on the byte code generated. |
llvm/lib/Target/X86/X86.td | ||
---|---|---|
437 | Talked offline and agreed to move to performance tuning. |
clang/test/Driver/x86-no-gather-no-scatter.cpp | ||
---|---|---|
4 | FYI, %clang_cl always must use -- before %s, else tests fail on macOS. I fixed this test in 547ee1c81fceaabcb. |
Move under "// X86 feature flags"