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]
Date:	Thu, 06 Nov 2014 16:09:08 +0800
From:	Weijie Yang <weijie.yang@...sung.com>
To:	kamezawa.hiroyu@...fujitsu.com, 'Minchan Kim' <minchan@...nel.org>
Cc:	'Andrew Morton' <akpm@...ux-foundation.org>, mgorman@...e.de,
	mina86@...a86.com, 'linux-kernel' <linux-kernel@...r.kernel.org>,
	'Linux-MM' <linux-mm@...ck.org>,
	'Weijie Yang' <weijie.yang.kh@...il.com>
Subject: [PATCH 2/2] mm: page_isolation: fix zone_freepage accounting

If race between isolatation and allocation happens, we could need to move
some freepages to MIGRATE_ISOLATE in __test_page_isolated_in_pageblock().
The current code ignores the zone_freepage accounting after the move,
which cause the zone NR_FREE_PAGES and NR_FREE_CMA_PAGES statistics incorrect.

This patch fixes this rare issue.

Signed-off-by: Weijie Yang <weijie.yang@...sung.com>
---
 mm/page_isolation.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 3ddc8b3..15b51de 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -193,12 +193,15 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
 			 * is MIGRATE_ISOLATE. Catch it and move the page into
 			 * MIGRATE_ISOLATE list.
 			 */
-			if (get_freepage_migratetype(page) != MIGRATE_ISOLATE) {
+			int migratetype = get_freepage_migratetype(page);
+			if (migratetype != MIGRATE_ISOLATE) {
 				struct page *end_page;
 
 				end_page = page + (1 << page_order(page)) - 1;
 				move_freepages(page_zone(page), page, end_page,
 						MIGRATE_ISOLATE);
+				__mod_zone_freepage_state(zone,
+					-(1 << page_order(page)), migratetype);
 			}
 			pfn += 1 << page_order(page);
 		}
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ