Google Engineers Propose Adding Linux Kernel Option For ARM SLS Mitigation
Mitigating the Arm Straight Line Speculation vulnerability involves using speculation barrier sequences following vulnerable instructions -- either the Speculation Barrier (SB) instruction or the DSB+ISB instruction sequence. The GCC compiler added its support along with the LLVM Clang compiler handling of this vulnerability in the same manner.
What's being proposed by Google engineers on the kernel side is simply a new Kconfig switch (HARDEN_SLS_ALL) that would flip on the compiler option of "-mharden-sls=all" for supported compilers. Thus the compiled kernel code would be properly mitigated against the straight-line speculation vulnerability for ARM and ARM64/AArch64. This isn't relevant to other architectures. With Google relying on LLVM Clang for building their production and development Linux kernels, that is their focus while -mharden-sls=all is also supported by GCC.
The "-mharden-sls=all" behavior with the modern compilers provide SLS hardening when encountering RETBR and BLR instructions.
The addition for SLS hardening of the Linux kernel via the compiler support is now under review on the kernel mailing list. The Kconfig option is simply defaulting to the strongest SLS "all" behavior so once this patch is mainlined we'll be sure to check for its performance impact and seeing if the HARDEN_SLS_ALL option ends up being widely used by distribution vendors in the name of increased ARM security.