Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Posted Mar 8, 2021 17:56 UTC (Mon) by farnz (subscriber, #17727)In reply to: Linux 5.12's very bad, double ungood day by pbonzini
Parent article: Linux 5.12's very bad, double ungood day
The bug is trivially awful (because it's obvious when you see it, but not when you're working on it); for most of the swap code, the swap location for any given page is referenced as an offset from the beginning of the swap file (or device). For a swap partition, this is fine - the offset from the beginning of the device is the correct location in the swap partition, too. For swap files, the correct offset on the device has to account for where on the device the filesystem has placed swap extents.
In the old code, map_swap_page calls map_swap_entry, which accounts for this offset. In the new code, it calls swap_page_sector, which was previously only ever used for swap partitions, and thus didn't account for the filesystem offset. The fix is to change swap_page_sector to account for swap files, and thus to look at the filesystem-provided extent map. That way, the foot gun is removed for everyone.
Posted Mar 8, 2021 18:10 UTC (Mon)
by pbonzini (subscriber, #60935)
[Link] (8 responses)
And doing that without pointing it out in the commit message is super sloppy. If you're saying that you're Just Inlining Code, you'd better just inline code
Posted Mar 9, 2021 8:32 UTC (Tue)
by epa (subscriber, #39769)
[Link] (7 responses)
Posted Mar 9, 2021 8:36 UTC (Tue)
by epa (subscriber, #39769)
[Link]
Posted Mar 9, 2021 19:09 UTC (Tue)
by NYKevin (subscriber, #129325)
[Link]
Posted Mar 9, 2021 21:01 UTC (Tue)
by error27 (subscriber, #8346)
[Link] (4 responses)
https://github.com/error27/rename_rev
It also has a -r NULL mode to review changes like "if (foo != NULL) {" --> "if (foo) {" because sometimes people get those transitions inverted. A bunch of little tricks like that.
I sometimes think like you do about ways to do something similar at the bytecode level or with static analysis but I can't think how that would work...
Posted Mar 10, 2021 7:23 UTC (Wed)
by epa (subscriber, #39769)
[Link] (3 responses)
Such a machine-readable record of the refactoring change would also be handy when rebasing. Instead of hitting a merge conflict on the 'renamed variable' commit, you could reapply that change using the refactoring tool. As long as both the old commit and the new one are pure refactorings (logical bytecode doesn't change), this can be done automatically as part of the rebase process, leaving the human programmer to concentrate on the conflicts that aren't trivial.
Posted Mar 10, 2021 8:10 UTC (Wed)
by error27 (subscriber, #8346)
[Link]
Posted Mar 20, 2021 23:50 UTC (Sat)
by Hi-Angel (guest, #110915)
[Link] (1 responses)
Posted Mar 21, 2021 5:34 UTC (Sun)
by pabs (subscriber, #43278)
[Link]
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day
Linux 5.12's very bad, double ungood day