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>] [day] [month] [year] [list]
Message-ID: <20230905153230.1291-1-justinjiang@vivo.com>
Date:   Tue,  5 Sep 2023 23:32:30 +0800
From:   Zhiguo Jiang <justinjiang@...o.com>
To:     Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Cc:     opensource.kernel@...o.com, Zhiguo Jiang <justinjiang@...o.com>
Subject: [PATCH] mm: page_alloc: remove MIGRATE_HIGHATOMIC order0 page

The MIGRATE_HIGHATOMIC pages are used for order > 0 allocation,
so pages in MIGRATE_HIGHATOMIC order0 freelist are invalid.

This patch can solve the allocation failure from buddy, due to
the reserved MIGRATE_HIGHATOMIC order0 pages.

Signed-off-by: Zhiguo Jiang <justinjiang@...o.com>
---
 mm/page_alloc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 14b51d1ef4c3..10c5b053bedf 100755
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -831,6 +831,9 @@ static inline void __free_one_page(struct page *page,
 	else
 		to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order);
 
+	if (unlikely(!order && is_migrate_highatomic(migratetype)))
+		migratetype = MIGRATE_MOVABLE;
+
 	if (to_tail)
 		add_to_free_list_tail(page, zone, order, migratetype);
 	else
@@ -1639,9 +1642,13 @@ static int move_freepages(struct zone *zone,
 		VM_BUG_ON_PAGE(page_zone(page) != zone, page);
 
 		order = buddy_order(page);
-		move_to_free_list(page, zone, order, migratetype);
+		if (unlikely(!order && is_migrate_highatomic(migratetype)))
+			move_to_free_list(page, zone, order, MIGRATE_MOVABLE);
+		else {
+			move_to_free_list(page, zone, order, migratetype);
+			pages_moved += 1 << order;
+		}
 		pfn += 1 << order;
-		pages_moved += 1 << order;
 	}
 
 	return pages_moved;
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ