This article is more than 1 year old
Linus Torvalds issues early Linux Kernel update to fix swapfile SNAFU
‘Subtle and very nasty bug’ meant 5.12 rc1 could trash entire filesystems
Linux overlord Linus Torvalds has rushed out a new release candidate of Linux 5.12 after the first in the new series was found to include a ‘subtle and very nasty bug’ that was so serious he marked rc1 as unsuitable for use.
“We had a very innocuous code cleanup and simplification that raised no red flags at all, but had a subtle and very nasty bug in it: swap files stopped working right. And they stopped working in a particularly bad way: the offset of the start of the swap file was lost,” Torvalds wrote in a March 3rd post to the Linux Kernel Mailing List.
“Swapping still happened, but it happened to the wrong part of the filesystem, with the obvious catastrophic end results.”
So catastrophic that, as Torvalds explained, “you can end up with a filesystem that is essentially overwritten by random swap data.”
“This is what we in the industry call ‘double ungood’.”
Torvalds therefore tweaked his public Git tree to change the name of "v5.12-rc1" to "v5.12-rc1-dontuse” and hopes people got the message.
The Linux overseer’s post defended the kernel development process that allowed the bug to sneak through.
'We're finding bugs way faster than we can fix them': Google sponsors 2 full-time devs to improve Linux securityREAD MORE
“Yes, this is very unfortunate, but it really wasn't a very obvious bug, and it didn't even show up in normal testing,” he wrote. “So I'm not blaming the developers in question, and it also wasn't due to the odd timing of the merge window, it was just simply an unusually nasty bug that did get caught and is fixed in the current tree.”
He also urged Linux testers to remember that release candidate 1 of new kernel is likely, by its very nature, to be a little loose.
“Most of our rc1 releases have been so solid over the years that people may have forgotten that ‘yeah, this is all the new code that can have nasty bugs in it’,” he wrote.
He also pointed out that a swapfile bug, even a nasty one like this, is not a major concern because “most people don't use a swap *file*, but a separate swap *partition*. And the bug in question really only happens for when you have a regular filesystem, and put a file on it as a swap.”
You can end up with a filesystem overwritten by random swap data. This is double ungood
“And, as far as I know, all the normal distributions set things up with swap partitions, not files, because honestly, swapfiles tend to be slower and have various other complexity issues.”
Torvalds allowed that swapfiles do, however, have their uses. Hence his unusual Friday post announcing “I'm just accelerating rc2 a bit.”
The chief penguin-herder said rc2 includes the swapfile fix and not much else of note other than “some io_uring thread handling re-organization”.
“I sincerely hope (and believe) that rc2 is in a lot better shape than rc1 was,” he concluded. ®