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]
Date:	Mon, 15 Jun 2009 12:14:41 +0100
From:	Mel Gorman <mel@....ul.ie>
To:	Mel Gorman <mel@....ul.ie>,
	Andrew Morton <akpm@...ux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Cc:	Rik van Riel <riel@...hat.com>,
	Christoph Lameter <cl@...ux-foundation.org>,
	Wu Fengguang <fengguang.wu@...el.com>, linuxram@...ibm.com,
	linux-mm <linux-mm@...ck.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] vmscan: Fix use of delta in zone_pagecache_reclaimable()

zone_pagecache_reclaimable() works out how many pages are in a state
that zone_reclaim() can reclaim based on the current zone_reclaim_mode.
As part of this, it calculates a delta to the number of unmapped pages.
The code was meant to check delta would not cause underflows and then apply
it but it got accidentally removed.

This patch properly uses delta. It's excessively paranoid at the moment
because it's impossible to underflow but the current form will make future
patches to zone_pagecache_reclaimable() fixing any other scan-heuristic
breakage easier to read and acts as self-documentation reminding authors
of future patches to consider underflow.

This is a fix to patch
vmscan-properly-account-for-the-number-of-page-cache-pages-zone_reclaim-can-reclaim.patch
and they should be merged together.

Signed-off-by: Mel Gorman <mel@....ul.ie>
---
 mm/vmscan.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 026f452..bd8e3ed 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2398,7 +2398,11 @@ static long zone_pagecache_reclaimable(struct zone *zone)
 	if (!(zone_reclaim_mode & RECLAIM_WRITE))
 		delta += zone_page_state(zone, NR_FILE_DIRTY);
 
-	return nr_pagecache_reclaimable;
+	/* Watch for any possible underflows due to delta */
+	if (unlikely(delta > nr_pagecache_reclaimable))
+		delta = nr_pagecache_reclaimable;
+
+	return nr_pagecache_reclaimable - delta;
 }
 
 /*
-- 
1.5.6.5

--
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