From 56991af94d6dd411f25c565cdd6bd241ab523b39 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Mon, 4 Dec 2023 16:43:18 +0800 Subject: [PATCH] mm: don't let userspace spam allocations warnings mainline inclusion from mainline-v5.0-rc8 commit 6c8fcc096be9d02f478c508052a41a4430506ab3 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8LMVO CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6c8fcc096be9d02f478c508052a41a4430506ab3 -------------------------------- 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: http://lkml.kernel.org/r/20190220204058.11676-1-daniel.vetter@ffwll.ch Signed-off-by: Daniel Vetter Reviewed-by: Andrew Morton Acked-by: Michal Hocko Reviewed-by: Kees Cook Cc: Mike Rapoport Cc: Roman Gushchin Cc: Vlastimil Babka Cc: Jan Stancek Cc: Andrey Ryabinin Cc: "Michael S. Tsirkin" Cc: Huang Ying Cc: Bartosz Golaszewski Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: ZhangPeng --- mm/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/util.c b/mm/util.c index 2b04ff4675d6..3a69fd0a15ca 100644 --- a/mm/util.c +++ b/mm/util.c @@ -160,7 +160,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); -- Gitee