Zack's Kernel News
Zack's Kernel News
Zack Brown reports on: Doing the Two-Step, and Doing the Too-Much Step.
Doing the Two-Step
Sometimes developer conflicts are navigated with grace and poise. For example, Bart Van Assche recently invited public comment on something he'd been working on. Specifically, he pointed out that the Clang C compiler was capable of various compile-time tests – including multithreading safety tests – that could potentially identify bugs in source code. To demonstrate this, he posted a patch containing fixes for almost 900 files in the Linux kernel repository. His main question to the kernel developers was, should Clang's compile-time thread safety checks be enabled by default for the Linux kernel?
Threads and thread safety are pretty insane topics, very easy to get wrong, and very difficult to debug. Threading simply means that there are a bunch of programs all running at the same time (e.g., your web browser, your file editor, your video player, and of course, a giant build of the Linux kernel sucking up resources and making your movie skip frames). Modern operating systems run these threads "simultaneously" by switching between them so quickly that you never notice only one of them is ever actually running at a given moment. But any time a thread requests a bit of memory or some disk space or any other resource on the system, it needs to make sure that it and it alone has access to that resource, even though a thousand other threads may make a thousand similar requests before that one thread can finish using that resource. To solve this, there are many different types of "locks" including mutexes, spinlocks, and others, whose job is to prevent other threads from using a resource for the duration of time it's been claimed. Imagine trying to write kernel features; never forgetting to lock the resources you need at the times you need them, in the ways they need to be locked; and then freeing them up again afterwards. These Clang tests are a lifeline to help you get all that insanity right.
However, using Clang tests wouldn't be as easy as flipping a switch. The kernel sources themselves would need to be modified – not necessarily in terms of the code itself, but the code would need to be "annotated" to let Clang know when and how to do its checks. Annotation is fun! It's essentially a code comment that gives the compiler hints as to how to proceed. A lot of languages support it nowadays, but annotation in some form or other goes back to the early days of computers. So, suggesting using it in Linux is nothing new, although Bart's specific suggestion would involve adopting Clang's specific annotations wholesale throughout the source tree.
[...]
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Photoshop on Linux?
A developer has patched Wine so that it'll run specific versions of Photoshop that depend on Adobe Creative Cloud.
-
Linux Mint 22.3 Now Available with New Tools
Linux Mint 22.3 has been released with a pair of new tools for system admins and some pretty cool new features.
-
New Linux Malware Targets Cloud-Based Linux Installations
VoidLink, a new Linux malware, should be of real concern because of its stealth and customization.
-
Say Goodbye to Middle-Mouse Paste
Both Gnome and Firefox have proposed getting rid of a long-time favorite Linux feature.
-
Manjaro 26.0 Primary Desktop Environments Default to Wayland
If you want to stick with X.Org, you'll be limited to the desktop environments you can choose.
-
Mozilla Plans to AI-ify Firefox
With a new CEO in control, Mozilla is doubling down on a strategy of trust, all the while leaning into AI.
-
Gnome Says No to AI-Generated Extensions
If you're a developer wanting to create a new Gnome extension, you'd best set aside that AI code generator, because the extension team will have none of that.
-
Parrot OS Switches to KDE Plasma Desktop
Yet another distro is making the move to the KDE Plasma desktop.
-
TUXEDO Announces Gemini 17
TUXEDO Computers has released the fourth generation of its Gemini laptop with plenty of updates.
-
Two New Distros Adopt Enlightenment
MX Moksha and AV Linux 25 join ranks with Bodhi Linux and embrace the Enlightenment desktop.

