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]
Message-ID: <54F6C809.1080709@jp.fujitsu.com>
Date:	Wed, 4 Mar 2015 17:53:29 +0900
From:	Kamezawa Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Xishi Qiu <qiuxishi@...wei.com>, Gu Zheng <guz.fnst@...fujitsu.com>
CC:	Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Tang Chen <tangchen@...fujitsu.com>,
	Yinghai Lu <yinghai@...nel.org>, Linux MM <linux-mm@...ck.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Toshi Kani <toshi.kani@...com>, Mel Gorman <mgorman@...e.de>,
	Tejun Heo <tj@...nel.org>, Xiexiuqi <xiexiuqi@...wei.com>,
	Hanjun Guo <guohanjun@...wei.com>,
	Li Zefan <lizefan@...wei.com>
Subject: Re: node-hotplug: is memset 0 safe in try_offline_node()?

On 2015/03/04 17:03, Xishi Qiu wrote:
> On 2015/3/4 11:56, Gu Zheng wrote:
>
>> Hi Xishi,
>> On 03/04/2015 10:52 AM, Xishi Qiu wrote:
>>
>>> On 2015/3/4 10:22, Xishi Qiu wrote:
>>>
>>>> On 2015/3/3 18:20, Gu Zheng wrote:
>>>>
>>>>> Hi Xishi,
>>>>> On 03/03/2015 11:30 AM, Xishi Qiu wrote:
>>>>>
>>>>>> When hot-remove a numa node, we will clear pgdat,
>>>>>> but is memset 0 safe in try_offline_node()?
>>>>>
>>>>> It is not safe here. In fact, this is a temporary solution here.
>>>>> As you know, pgdat is accessed lock-less now, so protection
>>>>> mechanism (RCU?) is needed to make it completely safe here,
>>>>> but it seems a bit over-kill.
>>>>>
>>>
>>> Hi Gu,
>>>
>>> Can we just remove "memset(pgdat, 0, sizeof(*pgdat));" ?
>>> I find this will be fine in the stress test except the warning
>>> when hot-add memory.
>>
>> As you see, it will trigger the warning in free_area_init_node().
>> Could you try the following patch? It will reset the pgdat before reuse it.
>>
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index 1778628..0717649 100644
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -1092,6 +1092,9 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
>>                          return NULL;
>>
>>                  arch_refresh_nodedata(nid, pgdat);
>> +       } else {
>> +               /* Reset the pgdat to reuse */
>> +               memset(pgdat, 0, sizeof(*pgdat));
>>          }
>
> Hi Gu,
>
> If schedule last a long time, next_zone may be still access the pgdat here,
> so it is not safe enough, right?
>

How about just reseting pgdat->nr_zones and pgdat->classzone_idx to be 0 rather than
memset() ?

It seems breaking pointer information in pgdat is not a choice.
Just proper "values" should be reset.

Thanks,
-Kame



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