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: <87ee3e5opu.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date:   Mon, 07 Mar 2022 13:14:05 +0800
From:   "Huang, Ying" <ying.huang@...el.com>
To:     Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc:     Miaohe Lin <linmiaohe@...wei.com>, <akpm@...ux-foundation.org>,
        <mike.kravetz@...cle.com>, <shy828301@...il.com>,
        <willy@...radead.org>, <ziy@...dia.com>, <minchan@...nel.org>,
        <apopple@...dia.com>, <ave.hansen@...ux.intel.com>,
        <o451686892@...il.com>, <almasrymina@...gle.com>,
        <jhubbard@...dia.com>, <rcampbell@...dia.com>, <peterx@...hat.com>,
        <naoya.horiguchi@....com>, <mhocko@...e.com>, <riel@...hat.com>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 14/16] mm/migration: fix potential invalid node access
 for reclaim-based migration

Baolin Wang <baolin.wang@...ux.alibaba.com> writes:

> On 3/4/2022 5:34 PM, Miaohe Lin wrote:
>> If we failed to setup hotplug state callbacks for mm/demotion:online in
>> some corner cases, node_demotion will be left uninitialized. Invalid node
>> might be returned from the next_demotion_node() when doing reclaim-based
>> migration. Use kcalloc to allocate node_demotion to fix the issue.
>> Fixes: ac16ec835314 ("mm: migrate: support multiple target nodes
>> demotion")
>> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
>> ---
>>   mm/migrate.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index 279940c0c064..7b1c0b988234 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -2516,9 +2516,9 @@ static int __init migrate_on_reclaim_init(void)
>>   {
>>   	int ret;
>>   -	node_demotion = kmalloc_array(nr_node_ids,
>> -				      sizeof(struct demotion_nodes),
>> -				      GFP_KERNEL);
>> +	node_demotion = kcalloc(nr_node_ids,
>> +				sizeof(struct demotion_nodes),
>> +				GFP_KERNEL);
>
> Nit: not sure if this is worthy of this rare corner case, but I think
> the target demotion nodes' default value should be NUMA_NO_NODE
> instead of 0.

The "nr" field of "struct demotion_nodes" should be initialized as 0.  I
think that is checked before "nodes[]" field.

Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ