Re: [Bugfix] sched: fix possible invalid memory access caused by CPU hot-addition

From: Jiang Liu
Date: Tue Apr 22 2014 - 22:45:31 EST


Hi Peter,
It's not for memoryless node, but to solve a race window
in CPU hot-addition. The related CPU hot-addition flow is:
1) Handle CPU hot-addition event
1.a) gather platform specific information
1.b) associate hot-added CPU with a node
1.c) create CPU device
2) User online hot-added CPUs through sysfs:
2.a) cpu_up()
2.b) ->try_online_node()
2.c) ->hotadd_new_pgdat()
2.d) ->node_set_online()

So between 1.b and 2.c, kmalloc_node(nid) may cause invalid
memory access without the node_online(nid) check.

Best Regards!
Gerry

On 2014/4/22 16:15, Peter Zijlstra wrote:
> On Tue, Apr 22, 2014 at 01:27:15PM +0800, Jiang Liu wrote:
>> When calling kzalloc_node(size, flags, node), we should first check
>> whether node is onlined, otherwise it may cause invalid memory access
>> as below.
>
> But this is only for memory less node crap, right?
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/