Zola Bridges from Google for the LLVM compiler suite, a patch implementing SESES (Speculative Execution Side Effect Suppression) protection, which helps block attacks on the speculative execution mechanism in Intel CPUs, similar to . The protection method is implemented at the compiler level and is based on the addition of instructions by the compiler during machine code generation , which are inserted before each memory read or write instruction, as well as before the first branching instruction in the group of instructions that concludes the block.
The LFENCE instruction waits for the completion of all previous memory read operations and prevents speculative execution of subsequent instructions after LFENCE until the completion is finished. The use of LFENCE significantly reduces performance, so it is recommended to apply the protection only in extreme cases for especially critical code. In addition to full protection, the patch offers three flags that allow selectively disabling certain levels of protection to mitigate negative performance impact.
In tests conducted, implementing SESES protection for the BoringSSL package led to a reduction in the number of operations executed by the library per second by 14 times — the performance of the protected version of the library was on average only 7.1% of the metrics of the unprotected version (with variation depending on the test ranging from 4% to 23%).
For comparison, earlier for the GNU Assembler, the mechanism that performs the insertion of LFENCE after each memory load operation and before certain branching instructions showed a performance decrease of about 5 times (22% of the code without protection). The protection method was also and engineered by Intel, but performance testing results for it have not yet been published. Initially, researchers who identified the LVI attack predicted a performance reduction when applying full protection of between 2 and 19 times.
Source: opennet.ru
