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] [day] [month] [year] [list]
Date:	Wed, 5 Nov 2014 10:17:34 +0800
From:	Tang Chen <tangchen@...fujitsu.com>
To:	Kamezawa Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	<akpm@...ux-foundation.org>, <santosh.shilimkar@...com>,
	<grygorii.strashko@...com>, <yinghai@...nel.org>,
	<isimatu.yasuaki@...fujitsu.co>, <fabf@...net.be>,
	<nzimmer@....com>, <wangnan0@...wei.com>, <vdavydov@...allels.com>,
	<toshi.kani@...com>, <phacht@...ux.vnet.ibm.com>, <tj@...nel.org>,
	<kirill.shutemov@...ux.intel.com>, <riel@...hat.com>,
	<luto@...capital.net>, <hpa@...ux.intel.com>,
	<aarcange@...hat.com>, <qiuxishi@...wei.com>, <mgorman@...e.de>,
	<rientjes@...gle.com>, <hannes@...xchg.org>
CC:	<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
	Gu Zheng <guz.fnst@...fujitsu.com>, <jiang.liu@...ux.intel.com>
Subject: Re: [PATCH 2/2] mem-hotplug: Fix wrong check for zone->pageset initialization
 in online_pages().

On 11/05/2014 09:01 AM, Kamezawa Hiroyuki wrote:
> ......
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 3ab01b2..bc0de0f 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1013,9 +1013,13 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
>   	 * If this zone is not populated, then it is not in zonelist.
>   	 * This means the page allocator ignores this zone.
>   	 * So, zonelist must be updated after online.
> +	 *
> +	 * If this zone is populated, zone->pageset could be initialized
> +	 * to boot_pageset for the first time a node is added. If so,
> +	 * zone->pageset should be allocated.
>   	 */
>   	mutex_lock(&zonelists_mutex);
> -	if (!populated_zone(zone)) {
> +	if (!populated_zone(zone) || !zone_pcp_initialized(zone)) {
> Please don't add another strange meanings to zone's pcplist.
>
> If you say zone->present_pages doesn't mean zone has pages in buddy list any more,
> please rewrite all parts using zone->present_pages including populated_zone().

Adding Liu Jiang...

I think zone->managed_pages was introduced by Liu Jiang in the following
patch:

>From 9feedc9d831e18ae6d0d15aa562e5e46ba53647b Mon Sep 17 00:00:00 2001
From: Jiang Liu <liuj97@...il.com>
Date: Wed, 12 Dec 2012 13:52:12 -0800
Subject: [PATCH 1/1] mm: introduce new field "managed_pages" to struct zone

Before this patch, zone->present_pages meant "amount of memory
(excluding holes)",
not the zone has pages in buddy system.

So I think zone->present_pages keeps its meaning as before. But it may
be abused
somewhere else, such as here.

> I think there are several parts calculates parameters based on present_pages.
>
> I myself doesn't welcome having both of compliated "managed pages" and "present pages"...
>
> How about adding 
>
> static inline int managed_zone(struct zone *zone)
> {
> 	return (!!zone->managed_pages);
> }
>
> for this bug fix ?

Yes, adding this function could fix this problem.

And by the way, we have the following code in onine_pages():

zone->present_pages += onlined_pages;

pgdat_resize_lock(zone->zone_pgdat, &flags);
zone->zone_pgdat->node_present_pages += onlined_pages;
pgdat_resize_unlock(zone->zone_pgdat, &flags);

We should do this when the zone size is changed, not where it is now.
Will send patches for this soon.

Thanks.

>
> Other parts, using present_pages, should be considered well.
>
>

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