diff options
author | Daniel Henrique Barboza <[email protected]> | 2022-02-24 15:23:12 -0300 |
---|---|---|
committer | Michael Ellerman <[email protected]> | 2022-03-01 23:41:01 +1100 |
commit | 749ed4a20657bcea66a6e082ca3dc0d228cbec80 (patch) | |
tree | 176f9a19e4bf1ff4e23179a3f80e1716a2027feb /scripts/gdb/linux/utils.py | |
parent | 973e2e6462405d85d3e8bb02d516d5fe6d1193ed (diff) |
powerpc/mm/numa: skip NUMA_NO_NODE onlining in parse_numa_properties()
Executing node_set_online() when nid = NUMA_NO_NODE results in an
undefined behavior. node_set_online() will call node_set_state(), into
__node_set(), into set_bit(), and since NUMA_NO_NODE is -1 we'll end up
doing a negative shift operation inside
arch/powerpc/include/asm/bitops.h. This potential UB was detected
running a kernel with CONFIG_UBSAN.
The behavior was introduced by commit 10f78fd0dabb ("powerpc/numa: Fix a
regression on memoryless node 0"), where the check for nid > 0 was
removed to fix a problem that was happening with nid = 0, but the result
is that now we're trying to online NUMA_NO_NODE nids as well.
Checking for nid >= 0 will allow node 0 to be onlined while avoiding
this UB with NUMA_NO_NODE.
Fixes: 10f78fd0dabb ("powerpc/numa: Fix a regression on memoryless node 0")
Reported-by: Ping Fang <[email protected]>
Signed-off-by: Daniel Henrique Barboza <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'scripts/gdb/linux/utils.py')
0 files changed, 0 insertions, 0 deletions