News: 0001525132

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Clang Thread Safety Checks Begin Uncovering Bugs In The Linux Kernel

([LLVM] 58 Minutes Ago Linux Kernel -Wthread-safety)


Posted to the Linux kernel mailing list this week were two competing solutions for new LLVM Clang capability / thread safety analysis to the Linux kernel. Two developers had separately been working on implementations for the Linux kernel to make use of Clang's "-Wthread-safety" functionality. Ultimately the upstream kernel will likely settle upon the superior or unified solution while already making use of these new checks is uncovering Linux kernel bugs.

The LLVM Clang compiler features Thread Safety Analysis capabilities as outlined in [1]the LLVM documentation to warn over potential race conditions. Google pursued this effort and is already being used within Google to uncover bugs.

Marco Elver posted [2]this set of 24 RFC patches with one approach to compiler-based capability and locking analysis.

Bart Van Assche had concurrently been working on compile-time thread-safety checking for the Linux kernel and this week also posted [3]this set of 33 RFC patches .

We'll see what solution proves superior and is ultimately accepted upstream or if some new unified approach evolves. In any event LLVM Linux developer Nick Desaulniers with Google [4]posted that these patch series have already been uncovering locking bugs within the Linux kernel.



[1] https://clang.llvm.org/docs/ThreadSafetyAnalysis.html

[2] https://lore.kernel.org/all/20250206181711.1902989-1-elver@google.com/T/#u

[3] https://lore.kernel.org/all/20250206175114.1974171-1-bvanassche@acm.org/

[4] https://fosstodon.org/@llvm/113958599237583456



phoronix

So from the depths of its enchantment, Terra was able to calculate a course
of action. Here at last was an opportunity to consort with Dirbanu on a
friendly basis -- great Durbanu which, since it had force fields which Earth
could not duplicate, must of necessity have many other things Earth could
use; mighty Durbanu before whom we would kneel in supplication (with purely-
for-defense bombs hidden in our pockets) with lowered heads (making invisible
the knife in our teeth) and ask for crumbs from their table (in order to
extrapolate the location of their kitchens).
-- Theodore Sturgeon, "The World Well Lost"