mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Make cpumask_of_node() robust against NUMA_NO_NODE
@ 2026-01-05 10:05 John Garry
  2026-01-05 10:05 ` [PATCH 1/4] include/asm-generic/topology.h: Remove unused definition of cpumask_of_node() John Garry
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: John Garry @ 2026-01-05 10:05 UTC (permalink / raw)
  To: chenhuacai, kernel, jiaxun.yang, tsbogend, tglx, mingo, bp,
	dave.hansen, hpa, luto, peterz, arnd, x86
  Cc: loongarch, linux-kernel, linux-mips, linux-arch, vulab, gregkh,
	rafael, dakr, John Garry

This series aims to remedy an issue that not all per-arch versions of
cpumask_of_node() are robust against NUMA_NO_NODE.

In my view, cpumask_of_node() should be able to handle NUMA_NO_NODE. This
is because NUMA_NO_NODE is a valid index from the following flow, where
the device NUMA node is not set (from default):

device_initialize(dev)
	set_dev_node(dev, NUMA_NO_NODE);

mask = cpumask_of_node(dev_to_node(dev));

The CONFIG_DEBUG_PER_CPU_MAPS=n x86 version cpumask_of_node() would
produce an array out-of-index issue (when passed NUMA_NO_NODE), which I
think is attempted to be worked around here:
https://lore.kernel.org/linux-scsi/cf0f9085-6c87-4dd5-9114-925723e68495@oracle.com/T/#mdedb68052e419b4bfca9ce45bb33b58988018945

I also see a CVE which also looks related:
https://nvd.nist.gov/vuln/detail/cve-2024-39277

Each per-arch version could be picked up separately, as can the
asm-generic change.

John Garry (4):
  include/asm-generic/topology.h: Remove unused definition of
    cpumask_of_node()
  LoongArch: Make cpumask_of_node() robust against NUMA_NO_NODE
  MIPS: Loongson: Make cpumask_of_node() robust against NUMA_NO_NODE
  x86/cpu/topology: Make cpumask_of_node() robust against NUMA_NO_NODE

 arch/loongarch/include/asm/topology.h            | 4 +++-
 arch/mips/include/asm/mach-loongson64/topology.h | 4 +++-
 arch/x86/include/asm/topology.h                  | 2 ++
 arch/x86/mm/numa.c                               | 2 ++
 include/asm-generic/topology.h                   | 8 ++------
 5 files changed, 12 insertions(+), 8 deletions(-)

-- 
2.43.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-05 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-05 10:05 [PATCH 0/4] Make cpumask_of_node() robust against NUMA_NO_NODE John Garry
2026-01-05 10:05 ` [PATCH 1/4] include/asm-generic/topology.h: Remove unused definition of cpumask_of_node() John Garry
2026-01-05 10:05 ` [PATCH 2/4] LoongArch: Make cpumask_of_node() robust against NUMA_NO_NODE John Garry
2026-01-05 12:54   ` Huacai Chen
2026-01-05 14:09     ` John Garry
2026-01-05 10:05 ` [PATCH 3/4] MIPS: Loongson: " John Garry
2026-01-05 10:05 ` [PATCH 4/4] x86/cpu/topology: " John Garry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®