Skip to content

mempolicy: treat empty nodes as unset - #2184

Merged
giuseppe merged 1 commit into
containers:mainfrom
kolyshkin:fix-2181
Aug 12, 2026
Merged

mempolicy: treat empty nodes as unset#2184
giuseppe merged 1 commit into
containers:mainfrom
kolyshkin:fix-2181

Conversation

@kolyshkin

Copy link
Copy Markdown
Collaborator

An empty nodes string is parsed as a non-NULL empty string, so cpuset_string_to_bitmask() returns a NULL bitmask of size 0, and the subsequent memcpy(dst, NULL, 0) violates memcpy's nonnull constraint.

Guard with is_empty_string(), the same way libcrun_set_cpu_affinity_from_string() does.

Fixes #2181

🤖 Generated with Claude Code

An empty "nodes" string is parsed as a non-NULL empty string, so
cpuset_string_to_bitmask() returns a NULL bitmask of size 0, and the
subsequent memcpy(dst, NULL, 0) violates memcpy's nonnull constraint.

Guard with is_empty_string(), the same way
libcrun_set_cpu_affinity_from_string() does.

Fixes: containers#2181

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@giuseppe giuseppe mentioned this pull request Aug 12, 2026

@giuseppe giuseppe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@giuseppe
giuseppe merged commit c926c48 into containers:main Aug 12, 2026
24 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty memoryPolicy.nodes results in UB

2 participants