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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240411091832.608280-1-haifeng.xu@shopee.com>
Date: Thu, 11 Apr 2024 09:18:32 +0000
From: Haifeng Xu <haifeng.xu@...pee.com>
To: cl@...ux.com,
	vbabka@...e.cz
Cc: penberg@...nel.org,
	rientjes@...gle.com,
	iamjoonsoo.kim@....com,
	akpm@...ux-foundation.org,
	roman.gushchin@...ux.dev,
	42.hyeyoo@...il.com,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Haifeng Xu <haifeng.xu@...pee.com>
Subject: [PATCH] slub: Clear __GFP_COMP flag when allocating 0 order page

We encounter warning messages when failing to create a new slab like
this:

page allocation failure: order:0, mode:0x1004000(GFP_NOWAIT|__GFP_COMP),
nodemask=(null)

It's a bit confusing for users because __GFP_COMP flag is used to create
compound page which implies the order should not be 0. This is because
minimum order will be tried if higher-order allocation fails and the
minimum order is 0. It's pointless to allocate 0 order page with __GFP_COMP
flag. Therefore, clear the __GFP_COMP flag when falling back to 0 order
allocation which makes the order and gfp flags matched.

Signed-off-by: Haifeng Xu <haifeng.xu@...pee.com>
---
 mm/slub.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/slub.c b/mm/slub.c
index a307d319e82c..d3e03dcb9ff2 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1875,6 +1875,13 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node,
 	struct slab *slab;
 	unsigned int order = oo_order(oo);
 
+	/*
+	 * If fallback to the minimum order allocation and the order is 0,
+	 * clear the __GFP_COMP flag.
+	 */
+	if (order == 0)
+		flags = flags & ~__GFP_COMP;
+
 	if (node == NUMA_NO_NODE)
 		folio = (struct folio *)alloc_pages(flags, order);
 	else
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ