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:	Tue, 11 Sep 2012 17:44:13 +0800
From:	Lai Jiangshan <laijs@...fujitsu.com>
To:	Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>
CC:	Mel Gorman <mgorman@...e.de>, David Rientjes <rientjes@...gle.com>,
	LKML <linux-kernel@...r.kernel.org>,
	x86 maintainers <x86@...nel.org>,
	Jiang Liu <jiang.liu@...wei.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Yinghai Lu <yinghai@...nel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"'FNST-Wen Congyang'" <wency@...fujitsu.com>
Subject: [V4 PATCH 27/27] memory,hotplug: Don't modify the zone_start_pfn
 outside of zone_span_writelock()

On 09/11/2012 08:40 AM, Yasuaki Ishimatsu wrote:
> Hi Lai,
> 
> Using memory_online to hot-added node's memory, the following kernel messages
> were shown. Is this a known issue?

Fixed.

Subject: Don't modify the zone_start_pfn outside of zone_span_writelock()

Original __add_zone() and new online_movable/online_kernel
maybe call sleep-able init_currently_empty_zone() to init wait_table,

but this function also modifies the zone_start_pfn without lock. 
so we move this code out, and ensure the modification of zone_start_pfn is done
with zone_span_writelock() held or booting.

Since zone_start_pfn is not modified by init_currently_empty_zone()
grow_zone_span() needs to be updated to be aware of empty zone.

Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
Reported-by: Yasuaki ISIMATU <isimatu.yasuaki@...fujitsu.com>
Tested-by: Wen Congyang <wency@...fujitsu.com>
---
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 3ad25f9..c26a4ea 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -201,7 +201,7 @@ static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
 	zone_span_writelock(zone);
 
 	old_zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
-	if (start_pfn < zone->zone_start_pfn)
+	if (!zone->zone_start_pfn || start_pfn < zone->zone_start_pfn)
 		zone->zone_start_pfn = start_pfn;
 
 	zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 009ac28..637b4f8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3991,8 +3991,6 @@ int __meminit init_currently_empty_zone(struct zone *zone,
 		return ret;
 	pgdat->nr_zones = zone_idx(zone) + 1;
 
-	zone->zone_start_pfn = zone_start_pfn;
-
 	mminit_dprintk(MMINIT_TRACE, "memmap_init",
 			"Initialising map node %d zone %lu pfns %lu -> %lu\n",
 			pgdat->node_id,
@@ -4459,6 +4457,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
 		ret = init_currently_empty_zone(zone, zone_start_pfn,
 						size, MEMMAP_EARLY);
 		BUG_ON(ret);
+		zone->zone_start_pfn = zone_start_pfn;
 		memmap_init(size, nid, j, zone_start_pfn);
 		zone_start_pfn += size;
 	}
--
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