Skip to content

rust: alloc: reject offline NUMA nodes in allocator - #1270

Open
Franklin-Qi wants to merge 1 commit into
Rust-for-Linux:rust-nextfrom
Franklin-Qi:fix/numa-node-online-check
Open

Franklin-Qi wants to merge 1 commit into
Rust-for-Linux:rust-nextfrom
Franklin-Qi:fix/numa-node-online-check

Conversation

@Franklin-Qi

@Franklin-Qi Franklin-Qi commented Nov 19, 2026 •

Copy link
Copy Markdown

NumaNode::new() only checks that the id is in [0, MAX_NUMNODES). Safe Allocator APIs can still forward an offline node into k[v]realloc_node_align(), which may dereference NODE_DATA(nid) == NULL and panic (GPF).

Reject offline nodes at the shared ReallocFunc boundary for nonzero allocations. Leave NUMA_NO_NODE and zero-sized free/realloc paths unchanged. A residual hotplug TOCTOU remains if a node goes offline after the check; this matches practical C usage for rejecting statically missing nodes from safe Rust.

Fixes: 7760b64 ("rust: add support for NUMA ids in allocations")
Cc: stable@vger.kernel.org
Reported-by: Georgios Androutsopoulos georgeandrout13@gmail.com
Closes: #1263

Signed-off-by: Franklin-Qi yusq77@gmail.com

Kernel Patch URL: https://lore.kernel.org/rust-for-linux/20261120021633.12274-1-yusq77@gmail.com/

NumaNode::new() only checks that the id is in [0, MAX_NUMNODES). Safe
Allocator APIs can still forward an offline node into
k[v]realloc_node_align(), which may dereference NODE_DATA(nid) == NULL
and panic (GPF).

Reject offline nodes at the shared ReallocFunc boundary for nonzero
allocations. Leave NUMA_NO_NODE and zero-sized free/realloc paths
unchanged. A residual hotplug TOCTOU remains if a node goes offline
after the check; this matches practical C usage for rejecting
statically missing nodes from safe Rust.

Fixes: 7760b64 ("rust: add support for NUMA ids in allocations")
Cc: stable@vger.kernel.org
Reported-by: Georgios Androutsopoulos <georgeandrout13@gmail.com>
Closes: Rust-for-Linux#1263

Signed-off-by: Franklin-Qi <yusq77@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

alloc: NumaNode::new() can allow safe Rust APIs to trigger a kernel NULL-pointer dereference

1 participant