Skip to content

[1.4] libct: fix resetting CPU affinity#5149

Merged
cyphar merged 1 commit intoopencontainers:release-1.4from
kolyshkin:1.4-5025
Mar 5, 2026
Merged

[1.4] libct: fix resetting CPU affinity#5149
cyphar merged 1 commit intoopencontainers:release-1.4from
kolyshkin:1.4-5025

Conversation

@kolyshkin
Copy link
Contributor

Backport of #5025 to release-1.4 branch.


unix.CPUSet is limited to 1024 CPUs. Calling
unix.SchedSetaffinity(pid, cpuset) removes all CPUs starting from 1024 from allowed CPUs of pid, even if cpuset is all ones. As a consequence, when runc tries to reset CPU affinity to "allow all" by default, it prevents all containers from CPUs 1024 onwards.

This change uses a huge CPU mask to play safe and get all possible CPUs enabled with a single sched_setaffinity call.

Fixes: #5023

(cherry picked from commit 700c944)

@kolyshkin kolyshkin added this to the 1.4.1 milestone Mar 4, 2026
@kolyshkin kolyshkin added the backport/1.4-pr A backport PR to release-1.4 label Mar 4, 2026
@kolyshkin kolyshkin changed the title libct: fix resetting CPU affinity [1.4] libct: fix resetting CPU affinity Mar 4, 2026
@cyphar
Copy link
Member

cyphar commented Mar 5, 2026

We need #5147 to fix the CI failure.

unix.CPUSet is limited to 1024 CPUs. Calling
unix.SchedSetaffinity(pid, cpuset) removes all CPUs starting from 1024
from allowed CPUs of pid, even if cpuset is all ones. As a
consequence, when runc tries to reset CPU affinity to "allow all" by
default, it prevents all containers from CPUs 1024 onwards.

This change uses a huge CPU mask to play safe and get all possible
CPUs enabled with a single sched_setaffinity call.

Fixes: opencontainers#5023

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
(cherry picked from commit 700c944)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@cyphar cyphar enabled auto-merge March 5, 2026 01:38
@cyphar cyphar merged commit 1f9669f into opencontainers:release-1.4 Mar 5, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.4-pr A backport PR to release-1.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants