Re: [PATCH RFC 00/33] Compile-time thread-safety checking

From: Bart Van Assche
Date: Thu Feb 06 2025 - 13:37:58 EST


On 2/6/25 10:20 AM, Marco Elver wrote:
Combining approach #1 and #2 may somehow be possible, but it is
currently eluding me. Clearly, based on the bugs that Bart found, some
way to do tree-wide analysis is very useful!
One idea was to have "capability-selective tree-wide analysis" (such
as mutex only) be controllable via a Kconfig option - the
implementation of that (without excessive ifdefs sprinkled
everywhere), however, most likely requires compiler support.

Depending on the feedback that results from these RFCs, I think we
will be able to plan better which direction things should go.

Thank you Marco for having explained clearly and in detail what the
possible paths are for enabling thread-safety support in the Linux
kernel. I agree that there are at least two possible approaches (maybe
there are even more possible approaches?). I'm interested in enabling
the Clang compiler flag -Wthread-safety across the entire kernel. Hence
the choice to start with annotating struct mutex only and to make the
necessary changes across the entire kernel tree.

I'm looking forward to the feedback from others about what their opinion
is about how to enable thread-safety checking in the Linux kernel.

Thanks,

Bart.