The new Linux kernel version 5.12RC1 has a file system corruption problem. Linus Torvalds, the father of Linux, issued an emergency notice and kicked out the 5.12 RC2 kernel version within three days.

Heart of the Machine, by The Devil and Du Wei.

In February, severe weather caused massive power outages in many parts of the United States. The Portland, Ore., area of Linus Torvalds, the father of Linux, was not spared. On a more encouraging note, Linus Torvalds managed to pull out a new version of the Linux kernel (version candidate), Linux 5.12RC1, even after six days without power.

However, Linus Torvalds recently sent a warning to the Linux kernel mailing list: Do not use the 5.12-rc1 kernel in their public Git tree.

Email address: lore.kernel.org/lkml/CAHk-=…

He wrote in an email:

You may have noticed that in my public Git tree, the “v5.12-rc1” tag has been renamed to “v5.12-rc1-dontuse”. It is still the same object, still internally displayed as “V5.12-rC1” and still signed by me, but the user visible name of the tag has changed.

File exchange processing problems may lead to serious consequences

As it turns out, Linus Torvalds did flag some code as “dontuse” because of a problem with the newly released 5.12 release candidate that severely disrupted swapfile processing. In particular, the updated code will lose the proper offset that points to the beginning of the interchange file. In Torvalds’ own words, “the exchange will still take place, but in places where the file system should not, with disastrous results.”

This means that when the kernel paged memory content onto disk, the data would fall on random parts of the same disk and partition as the swap file, but not on the same disk and partition as the file, but on the same disk and partition as the garbage content that was sent directly to the original sector of the disk. This means that not only does it overwrite data in existing files, but it also affects large chunks of metadata whose corruption can render the entire file system unmounted and unusable.

Torvalds points out that if you don’t use swaps, the problem doesn’t matter to you; If you use swap partitions instead of swap files, you won’t be bothered. However, he says that while he knows the kernel well, he’s not familiar with all the basic issues that the average end user cares about:

As far as I know, all normal distributions use swap partitions instead of swap files because swap files are slow and have multiple other complexities.

Many distributions still swap partitions by default, rather than swap files. But Ubuntu, perhaps the most widely deployed Linux distribution in the world, installed swap files by default more than four years ago. If you’re an Ubuntu user (or an Ubuntu derivative), you might get a swap file, and this bug could destroy the entire root file system.

In addition to the above questions, Torvalds also reminds individual users of what to do with the newly released Linux kernel (release candidate). It is best not to work around this version of the kernel, which can cause serious and persistent bugs. Torvalds says:

I want to make sure that no one opens a new theme branch with 5.12-Rc1. I know some developers are thinking, “Now that RC1 is out, I’m going to put all my development work into its merge window. I’m going to move to RC1 so I can build on that for the next release.” But please don’t do it this time. This process might go well because the developer used the usual partitioning setup, but it would be a poor foundation for someone who might split the area in two.

This brings up another issue that Linux users need to be aware of: don’t blindly use code that isn’t fully tested. Linux kernel release candidates are usually very solid, so many people want to try out new features as early as possible, but doing so can have very bad consequences. You can probably avoid some serious consequences by waiting for the code to go into production.

Linux 5.12-RC2 has been released

The 5.12-Rc2 kernel version of Linux was released within days of the discovery of the swap file problem with version 5.12-RC1.

Of 5.12-RC2, Torvalds said, “In addition to the fix for the IO offset of the swap files, the release also reorganizes some of the IO_uring thread handling, which not only fixes some basic issues, but also makes the code smaller and simpler.”

Email address: lore.kernel.org/lkml/CAHk-=…