Re: mmotm woes, mainly compaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/12/2016 09:18 AM, Hugh Dickins wrote:
> 2. Fix crash in get_pfnblock_flags_mask() from suitable_migration_target()
>     from isolate_freepages(): there's a case when that "block_start_pfn -=
>     pageblock_nr_pages" loop can pass through 0 and end up trying to access
>     a pageblock before the start of the mem_map[].  (I have not worked out
>     why this never hit me before 4.6-rc2-mm1, it looks much older.)

This is actually my fresh mmotm bug, thanks for catching that!

Fix for:
mm-compaction-wrap-calculating-first-and-last-pfn-of-pageblock.patch

----8<----
>From 45330dfb350d6b3bc72bcdaccc226bcc286e1236 Mon Sep 17 00:00:00 2001
From: Vlastimil Babka <vbabka@xxxxxxx>
Date: Tue, 12 Apr 2016 09:54:33 +0200
Subject: [PATCH] mm, compaction: fix crash in get_pfnblock_flags_mask() from
 isolate_freepages():

In isolate_freepages(), low_pfn was mistakenly initialized to
pageblock_start_pfn() instead of pageblock_end_pfn(), creating a possible
underflow, as described by Hugh:

   There's a case when that "block_start_pfn -= pageblock_nr_pages" loop can
   pass through 0 and end up trying to access a pageblock before the start of
   the mem_map[].

Reported-by: Hugh Dickins <hughd@xxxxxxxxxx>
Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
---
 mm/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 315e5d57e7e9..67f886ecd773 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1012,7 +1012,7 @@ static void isolate_freepages(struct compact_control *cc)
 	block_start_pfn = pageblock_start_pfn(cc->free_pfn);
 	block_end_pfn = min(block_start_pfn + pageblock_nr_pages,
 						zone_end_pfn(zone));
-	low_pfn = pageblock_start_pfn(cc->migrate_pfn);
+	low_pfn = pageblock_end_pfn(cc->migrate_pfn);
 
 	/*
 	 * Isolate free pages until enough are available to migrate the
-- 
2.8.1


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]