Clang Thread Safety Checks Begin Uncovering Bugs In The Linux Kernel

Written by Michael Larabel in LLVM on 8 February 2025 at 11:02 AM EST. 57 Comments
LLVM
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 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.

bugs uncovered in the kernel post

Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week