Re: [PATCH] mm/util: make memdup_user_nul() similar to memdup_user()

From: Andrew Morton
Date: Mon Dec 23 2024 - 20:26:00 EST



tl;dr: patch does three different things, some of which appear to be
needed in -stable kernels.


On Sat, 21 Dec 2024 16:47:29 +0900 Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:

> Since the string data to copy from userspace is likely less than PAGE_SIZE
> bytes, replace GFP_KERNEL with GFP_USER like commit 6c2c97a24f09
> ("memdup_user(): switch to GFP_USER") does

Please provide a reason for this change. Does it have user-visible
effects? If so, what are they?

> and add __GFP_NOWARN like commit
> 6c8fcc096be9 ("mm: don't let userspace spam allocations warnings") does.

Ditto.

> Also, use dedicated slab buckets like commit d73778e4b867 ("mm/util: Use
> dedicated slab buckets for memdup_user()") does.

Ditto.

> Reported-by: syzbot+7e12e97b36154c54414b@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=7e12e97b36154c54414b

That's a userspace-triggered WARN, so we'll want to backport the fix
into -stable kernels. But we won't necessarly want to backport the
other two changes, depending upon what their effects are.


In other words, it would be better to present this as a series of three
(fully changelogged!) patches, with one or more of them cc:stable.

If we really do want to roll all three changes into a single patch and
backport that then please let's justify all three backports within the
changelog.