Live data from Hacker News

A warning about 5.12-rc1

lwn.net

21–30 of 115 posts

Re: A warning about 5.12-rc1

#21

> And, as far as I know, all the normal distributions set things up with swap partitions, not files I guess Ubuntu is not a "normal" distribution then? Because it uses a swap file by default.

While it's the default setup of the auto installer it common (and IMHO best) practice to change it to install with a swap partition.

It's just that it's much easier for anyone who just gets started with Linux to have a swap file.

For example for hibernation you swap partition needs to have the right size. But people do upgrade their desktop RAM and as such would need to resize the partition, which isn't easy (because likely it means shrinking another partition)...

So for a distribution like ubuntu the "non-normal" case became the default.

Still this mail was targeting people which install pre-release versions of Linux kernerls which is a group of people relatively unlikely to use a swap file.

Re: A warning about 5.12-rc1

#22
As no one did a TLDR: if you use a swapfile, it could overwrite part of the the filesystem where the swapfile exist.

Don't use swapfiles if you can. Use a dedicated partition, there are many advantages (including automatic RAID0 if you have a swap partition on each drive)

Re: A warning about 5.12-rc1

#23
post #5

I was interested to see the code. Linus's message doesn't provide commit IDs, so you have to go looking yourself. I believe this is the commit which introduces the bug: https://github.com/torvalds/linux/commit/48d15436fde6feebcde... And I believe this is the commit which fixes it: https://github.com/torvalds/linux/commit/caf6912f3f4af723234...

Why do you believe that’s the commit that caused the bug?

The second commit self-disambiguates with "swap: fix swapfile read/write offset" and the commit message notes "fixes: 48d1543", which is the first linked commit.

Re: A warning about 5.12-rc1

#24
post #5

I was interested to see the code. Linus's message doesn't provide commit IDs, so you have to go looking yourself. I believe this is the commit which introduces the bug: https://github.com/torvalds/linux/commit/48d15436fde6feebcde... And I believe this is the commit which fixes it: https://github.com/torvalds/linux/commit/caf6912f3f4af723234...

Why do you believe that’s the commit that caused the bug?

Because of the commit message of the fix?

Re: A warning about 5.12-rc1

#25
post #11

Earlier quoted context omitted.

Swapfiles are quite common when you use FDE (say, LUKS) and you don't want your swap to be in plaintext on disk. (Although, you could just have an entire LUKS-encrypted swap volume instead of a swapfile...)

While maybe not the most performant my favorite is LVM2 on top of a single large LUKS-encrypted partition (+no boot partition and a single (custom platform key) signed EFI bootable kernel blob containing the initram fs in the EFI partition). This: - Allows a encrypted swap partition (on in lvm2 on top of luks, sure not perfect but I don't really use swap) - Allows hibernation (which I don't really use tbh.) - Fully e…

Would the bug Linus is describing still bite you if your swap is in a separate LVM partition? (That's how Ubuntu 20.04 sets things up by default.)

Re: A warning about 5.12-rc1

#27
post #6

this is unlikely to hurt you unless you use a swap file , rather than a dedicated swap partition. for performance reasons most any modern linux installation would be using a dedicated swap partition, that is defined as swap-only during the install process with mkswap In my experience some of the reasons for using a swap file were more common maybe 10 or 15 years ago. Nowadays with disk space being less costly and rar…

Ubuntu uses a swap file by default since 17.04 Zesty: https://blog.surgut.co.uk/2016/12/swapfiles-by-default-in-ub...

But as otherwise discussed this only made it into a release candidate and not an actual release. So the impact is minimal.

Re: A warning about 5.12-rc1

#30
> it didn't even show up in normal testing, exactly because swapfiles just aren't normal.

Uhh, does it mean swapfiles are undertested in the Linux kernel? Or is there some "non-normal" extra testing that is being run for non-rc releases, but not for rc ones? (!?)

Post reply on HN