Re: Patch "khugepaged: khugepaged_test_exit() check mmget_still_valid()" has been added to the 5.8-stable tree

Sasha Levin
2020-08-22T21:20:56Z

On Fri, Aug 21, 2020 at 06:26:15PM -0700, Hugh Dickins wrote:
>On Wed, 19 Aug 2020, Greg KH wrote:
>> On Wed, Aug 19, 2020 at 06:32:26AM -0700, Hugh Dickins wrote:
>> > On Wed, 19 Aug 2020, gregkh@linuxfoundation.org wrote:
>> > >
>> > > This is a note to let you know that I've just added the patch titled
>> > >
>> > > khugepaged: khugepaged_test_exit() check mmget_still_valid()
>> > >
>> > > to the 5.8-stable tree which can be found at:
>> > > http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>> > >
>> > > The filename of the patch is:
>> > > khugepaged-khugepaged_test_exit-check-mmget_still_valid.patch
>> > > and it can be found in the queue-5.8 subdirectory.
>> > >
>> > > If you, or anyone else, feels it should not be added to the stable tree,
>> > > please let <stable@vger.kernel.org> know about it.
>> >
>> > Please hold this one back for the moment: we shall want it, but syzbot
>> > detected one place where it can lead to a VM_BUG_ON_MM(). The fix to
>> > that is currently in Andrew's tree, but not yet in Linus's - when it
>> > gets there, I'll send you its git commit id in reply to this mail.
>> >
>> > This patch failed to apply to earlier releases: I'll send the fixup for
>> > those at that time. (Fixups for another patch to follow later today.)
>>
>> Now dropped, thanks!
>
>f3f99d63a815 khugepaged: adjust VM_BUG_ON_MM() in __khugepaged_enter()
>has now reached Linus's tree, so will reach your tree when you next pull.
>
>When that one is ready, please reinstate this commit that we held back:
>bbe98f9cadff khugepaged: khugepaged_test_exit() check mmget_still_valid()
>
>The mmap_sem->mmap_lock change means I must then send you a backport of
>bbe98f9cadff for 5.7, 5.4, 4.19, 4.14, 4.9: one backport will do for all
>of those, and f3f99d63a815 should cherry-pick cleanly into them all.
>
>But you also marked bbe98f9cadff for 4.4: I had not expected that,
>but I think you're right - for whatever reason (probably inertia,
>it was tiresome because khugepaged.c got split from huge_memory.c),
>4.4 lacks a backport of 59ea6d06cfa9 (though it does have the commit
>that depended on), and backports of these two will serve just as well
>to fix what it was required to fix: I'll send them too.
>
>Thanks: I'm sorry that this is all so confusing,
>kudos to syzbot for catching my error as quickly as it did.

I've followed your instructions and backported the patches:

bbe98f9cadff ("khugepaged: khugepaged_test_exit() check
mmget_still_valid()") - to all branches.
f3f99d63a815 ("khugepaged: adjust VM_BUG_ON_MM() in
__khugepaged_enter()") - to all branches.
59ea6d06cfa9 ("coredump: fix race condition between collapse_huge_page()
and core dumping") - for 4.4.

Thanks!

--
Thanks,
Sasha