public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: chenhuacai@kernel.org, kernel@xen0n.name,
	jiaxun.yang@flygoat.com, tsbogend@alpha.franken.de,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hpa@zytor.com, luto@kernel.org,
	peterz@infradead.org, arnd@arndb.de, x86@kernel.org
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org, linux-arch@vger.kernel.org,
	vulab@iscas.ac.cn, gregkh@linuxfoundation.org, rafael@kernel.org,
	dakr@kernel.org, John Garry <john.g.garry@oracle.com>
Subject: [PATCH v2 0/4] Make cpumask_of_node() robust against NUMA_NO_NODE
Date: Wed,  7 Jan 2026 09:40:03 +0000	[thread overview]
Message-ID: <20260107094007.966496-1-john.g.garry@oracle.com> (raw)

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.

Differences to v1:
- Put mips and loongarch definition on a single line (Huacai)

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            | 2 +-
 arch/mips/include/asm/mach-loongson64/topology.h | 2 +-
 arch/x86/include/asm/topology.h                  | 2 ++
 arch/x86/mm/numa.c                               | 2 ++
 include/asm-generic/topology.h                   | 8 ++------
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.43.5


             reply	other threads:[~2026-01-07  9:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07  9:40 John Garry [this message]
2026-01-07  9:40 ` [PATCH v2 1/4] include/asm-generic/topology.h: Remove unused definition of cpumask_of_node() John Garry
2026-01-30 12:24   ` John Garry
2026-01-30 16:12     ` Arnd Bergmann
2026-01-07  9:40 ` [PATCH v2 2/4] LoongArch: Make cpumask_of_node() robust against NUMA_NO_NODE John Garry
2026-01-25  3:55   ` Huacai Chen
2026-01-30 12:20     ` John Garry
2026-01-31  8:50       ` Huacai Chen
2026-01-07  9:40 ` [PATCH v2 3/4] MIPS: Loongson: " John Garry
2026-01-25  3:55   ` Huacai Chen
2026-01-30 12:21     ` John Garry
2026-01-30 12:40       ` Thomas Bogendoerfer
2026-01-30 14:34   ` Thomas Bogendoerfer
2026-01-07  9:40 ` [PATCH v2 4/4] x86/cpu/topology: " John Garry
2026-01-19  8:38 ` [PATCH v2 0/4] " John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260107094007.966496-1-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=chenhuacai@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kernel@xen0n.name \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=vulab@iscas.ac.cn \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox