mm: don’t let userspace spam allocations warnings [Linux 5.0]

mm: don’t let userspace spam allocations warnings [Linux 5.0]

This Linux kernel change "mm: don’t let userspace spam allocations warnings" is included in the Linux 5.0 release. This change is authored by Daniel Vetter <daniel.vetter [at]> on Wed Feb 20 22:20:42 2019 -0800. The commit for this change in Linux stable tree is 6c8fcc0 (patch).

mm: don't let userspace spam allocations warnings

memdump_user usually gets fed unchecked userspace input.  Blasting a
full backtrace into dmesg every time is a bit excessive - I'm not sure
on the kernel rule in general, but at least in drm we're trying not to
let unpriviledge userspace spam the logs freely.  Definitely not entire
warning backtraces.

It also means more filtering for our CI, because our testsuite exercises
these corner cases and so hits these a lot.

Link:[email protected]
Signed-off-by: Daniel Vetter <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Jan Stancek <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Huang Ying <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 mm/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/util.c b/mm/util.c
index 1ea0551..379319b 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -150,7 +150,7 @@ void *memdup_user(const void __user *src, size_t len)
    void *p;

-   p = kmalloc_track_caller(len, GFP_USER);
+   p = kmalloc_track_caller(len, GFP_USER | __GFP_NOWARN);
    if (!p)
        return ERR_PTR(-ENOMEM);

Leave a Reply

Your email address will not be published. Required fields are marked *