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 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 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 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 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 posted that these patch series have already been uncovering locking bugs within the Linux kernel.