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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250509115126.63190-15-byungchul@sk.com>
Date: Fri,  9 May 2025 20:51:21 +0900
From: Byungchul Park <byungchul@...com>
To: willy@...radead.org,
	netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
	linux-mm@...ck.org,
	kernel_team@...ynix.com,
	kuba@...nel.org,
	almasrymina@...gle.com,
	ilias.apalodimas@...aro.org,
	harry.yoo@...cle.com,
	hawk@...nel.org,
	akpm@...ux-foundation.org,
	ast@...nel.org,
	daniel@...earbox.net,
	davem@...emloft.net,
	john.fastabend@...il.com,
	andrew+netdev@...n.ch,
	edumazet@...gle.com,
	pabeni@...hat.com,
	vishal.moola@...il.com
Subject: [RFC 14/19] mm: page_alloc: do not directly access page->pp_magic but use is_pp_page()

To simplify struct page, the effort to seperate its own descriptor from
struct page is required and the work for page pool is on going.

To achieve that, all the code should avoid accessing page pool members
of struct page directly, but use safe API for the corresponding purpose,
that is is_pp_page() in this case.

Use is_pp_page() instead of accessing the members directly, when
checking if a page comes from page pool or not.

Signed-off-by: Byungchul Park <byungchul@...com>
---
 mm/page_alloc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a6fe1e9b95941..cf672b9ab7086 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -55,6 +55,7 @@
 #include <linux/delayacct.h>
 #include <linux/cacheinfo.h>
 #include <linux/pgalloc_tag.h>
+#include <net/page_pool/types.h> /* for page pool checking */
 #include <asm/div64.h>
 #include "internal.h"
 #include "shuffle.h"
@@ -899,7 +900,7 @@ static inline bool page_expected_state(struct page *page,
 			page->memcg_data |
 #endif
 #ifdef CONFIG_PAGE_POOL
-			((page->pp_magic & ~0x3UL) == PP_SIGNATURE) |
+			(is_pp_page(page)) |
 #endif
 			(page->flags & check_flags)))
 		return false;
@@ -928,7 +929,7 @@ static const char *page_bad_reason(struct page *page, unsigned long flags)
 		bad_reason = "page still charged to cgroup";
 #endif
 #ifdef CONFIG_PAGE_POOL
-	if (unlikely((page->pp_magic & ~0x3UL) == PP_SIGNATURE))
+	if (unlikely(is_pp_page(page)))
 		bad_reason = "page_pool leak";
 #endif
 	return bad_reason;
-- 
2.17.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ