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: <20240318121443.3991104-1-alexs@kernel.org>
Date: Mon, 18 Mar 2024 20:14:30 +0800
From: alexs@...nel.org
To: kasong@...cent.com,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-mm@...ck.org (open list:MEMORY MANAGEMENT),
	linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 01/12] mm/ksm: catch tail page abnormal in page_stable_node

From: Alex Shi <alexs@...nel.org>

commit 19138349ed59 ("mm/migrate: Add folio_migrate_flags()") change the
meaning of func page_stable_node() to check the compound head for tail
'page' instead of tail page self.
But seems both semantics are same at results, the func always return NULL
 for tail page. So adding a bug monitor here in case of abnormal.

Signed-off-by: Alex Shi <alexs@...nel.org>
Cc: Izik Eidus <izik.eidus@...ellosystems.com>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: Andrea Arcangeli <aarcange@...hat.com>
Cc: Hugh Dickins <hughd@...gle.com>
Cc: Chris Wright <chrisw@...s-sol.org>
To: linux-kernel@...r.kernel.org
To: linux-mm@...ck.org
To: Andrew Morton <akpm@...ux-foundation.org>
---
 mm/ksm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index 8c001819cf10..3ff469961927 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1091,7 +1091,12 @@ static inline struct ksm_stable_node *folio_stable_node(struct folio *folio)
 
 static inline struct ksm_stable_node *page_stable_node(struct page *page)
 {
-	return folio_stable_node(page_folio(page));
+	struct ksm_stable_node *node;
+
+	node = folio_stable_node(page_folio(page));
+	VM_BUG_ON_PAGE(PageTail(page) && node, page);
+
+	return node;
 }
 
 static inline void set_page_stable_node(struct page *page,
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ