On Mon, 19 Jul 2021, Peter Xu wrote: > On Mon, Jul 19, 2021 at 12:11:21PM -0700, Hugh Dickins wrote: > > > > But I'm confident that 8f34f1eac382 will prove to be the fix, so Peter > > please prepare some backports of that for the various stable/longterm > > kernels that need it - I've not looked into whether it applies cleanly, > > or depends on other commits too. You fixed several related but different > > things in that commit: but this one is the worst, because it can corrupt > > even those who are not using UFFD_WP at all. > > Looks right to me, b569a1760782 ("userfaultfd: wp: drop _PAGE_UFFD_WP properly > when fork", 2020-04-07) seems to be the culprit. I didn't notice the side > effect in the bug or in the fix, or it should have already land stables. I am > very sorry for such a preliminary bug that caused this fallout - I really can't > tell why I completely didn't look at is_swap_pte() that's so obvious indeed. > > I checked it up, 5.6.y doesn't have the issue commit yet as it's not marked as > "fixes". It started to show up in 5.7.y~5.13.y. 5.14-rc1 has 8f34f1eac382 which > is the fix. So I think we need the fix or equivalent fix for 5.7.y~5.13.y. > > 5.12.y & 5.13.y can pick up the fix 8f34f1eac382 cleanly. For the olders > (5.7.y~5.11.y) they can't. I plan to revert b569a1760782 instead. > ... > > Please let me know if there's any comment on the backport plan above, or I'll > prepare the patches for all the branches before tomorrow. Thanks for getting on to it so quickly, Peter. The only non-EOL stable/longterm releases are then 5.13, 5.12 and 5.10. I have no appreciation of the importance of UFFD_EVENT_FORK support for uffd-wp. And no appreciation of the importance of the other bugs you fixed in 8f34f1eac382, and other uffd-wp fixes you may have made recently, some backported, some not. But I think it is worth giving 5.10, the longterm, a little more consideration: don't be driven by whether 8f34f1eac382 applies cleanly (all 5.13 and 5.12 would require then is a mail to GregKH Cc stable asking him to add that commit), but by how important the support is to users of 5.10, and how far away from working safely it is - maybe a 5.10-specific patch would be worthwhile, maybe not, I cannot judge. Hugh