[$] Detecting missing memory barriers with KCSAN

Post Syndicated from original https://lwn.net/Articles/877200/rss

Writing (correct) concurrent code that uses locking to avoid race
conditions is difficult enough. When the objective is to use lockless algorithms, relying on memory
barriers instead of locks to eliminate locking overhead, the problem
becomes harder
still. Bugs are easy to create and hard to find in this type of code.
There may be some help on the way, though, in the form of this
patch set
from Marco Elver that enhances the Kernel
Concurrency
Sanitizer
(KCSAN) with the ability to detect some types of missing
memory barriers.