Opt-In L1 Cache Flushing To Try For Linux 5.15 To Help With The Paranoid, Future CPU Vulnerabilities

Linus Torvalds criticized this L1d cache flushing for the paranoid as being poorly engineered in its initial form around its software flushing fallback that may not even flush the L1 data cache in some instances, applications potentially abusing this interface, and the performance impact this flushing would have on other applications. Those issues along with other criticism from Linus led him to reverting it shortly after it was originally sent in for Linux 5.8.
Since then the code has been revised so now it should be less "stupid". This opt-in L1d cache flushing now requires a special boot flag (l1d_flush=on) for it to be even enabled at run-time, the L1d flushing is disabled for CPUs not affected by the Intel L1TF Foreshadow vulnerability, and the previously criticized L1d software flushing fallback path is removed.
In now trying to sell this opt-in, per-application L1 data cache flushing on context switch feature to Linus Torvalds, the pull request sums it up as, "A stop gap for potential future speculation related hardware vulnerabilities and a mechanism for truly security paranoid applications. It allows a task to request that the L1D cache is flushed when the kernel switches to a different mm. This can be requested via prctl()."
We'll see what Linus Torvalds thinks of it this time around and whether it will make it into Linux 5.15.
17 Comments