lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1625563471-3873-1-git-send-email-wangqing@vivo.com>
Date:   Tue,  6 Jul 2021 17:24:31 +0800
From:   Wang Qing <wangqing@...o.com>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm@...ck.org (open list:MEMORY MANAGEMENT),
        linux-kernel@...r.kernel.org (open list)
Cc:     mgorman@...hsingularity.net, Qiang.Zhang@...driver.com,
        Wang Qing <wangqing@...o.com>
Subject: [PATCH V2] mm: add GFP_ATOMIC flag after local_lock_irqsave

prep_new_page() will allocate memory in some scenarios. 

Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:96
___might_sleep.cold+0x1f1/0x237 kernel/sched/core.c:9153
prepare_alloc_pages+0x3da/0x580 mm/page_alloc.c:5179
__alloc_pages+0x12f/0x500 mm/page_alloc.c:5375
alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272
stack_depot_save+0x39d/0x4e0 lib/stackdepot.c:303
save_stack+0x15e/0x1e0 mm/page_owner.c:120
__set_page_owner+0x50/0x290 mm/page_owner.c:181
prep_new_page mm/page_alloc.c:2445 [inline]
__alloc_pages_bulk+0x8b9/0x1870 mm/page_alloc.c:5313

So we add GFP_ATOMIC and remove GFP_KERNEL flag.

Reported-and-tested-by: syzbot+b07d8440edb5f8988eea@...kaller.appspotmail.com
Signed-off-by: Wang Qing <wangqing@...o.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d6e94cc..3016ba5
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5309,7 +5309,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
 		}
 		nr_account++;
 
-		prep_new_page(page, 0, gfp, 0);
+		prep_new_page(page, 0, gfp | GFP_ATOMIC & ~GFP_KERNEL, 0);
 		if (page_list)
 			list_add(&page->lru, page_list);
 		else
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ