[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56FD2285.4080600@suse.cz>
Date: Thu, 31 Mar 2016 15:13:41 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Andrew Morton <akpm@...ux-foundation.org>,
Xishi Qiu <qiuxishi@...wei.com>
Cc: Joonsoo Kim <js1304@...il.com>,
David Rientjes <rientjes@...gle.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Laura Abbott <lauraa@...eaurora.org>, zhuhui@...omi.com,
wangxq10@....edu.cn, Linux MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: fix invalid node in alloc_migrate_target()
On 03/29/2016 03:06 PM, Vlastimil Babka wrote:
> On 03/25/2016 08:22 PM, Andrew Morton wrote:
>> Also, mm/mempolicy.c:offset_il_node() worries me:
>>
>> do {
>> nid = next_node(nid, pol->v.nodes);
>> c++;
>> } while (c <= target);
>>
>> Can't `nid' hit MAX_NUMNODES?
>
> AFAICS it can. interleave_nid() uses this and the nid is then used e.g.
> in node_zonelist() where it's used for NODE_DATA(nid). That's quite
> scary. It also predates git. Why don't we see crashes or KASAN finding this?
Ah, I see. In offset_il_node(), nid is initialized to -1, and the number
of do-while iterations calling next_node() is up to the number of bits
set in the pol->v.nodes bitmap, so it can't reach past the last set bit
and return MAX_NUMNODES.
Powered by blists - more mailing lists