Public bug reported:

[ Impact ]
When /proc/<pid>/cpuset is unavailable, hwloc uses the process's cgroup v2 
membership path. If that cgroup has no cpuset.cpus.effective or 
cpuset.mems.effective files because it inherits restrictions from an ancestor, 
hwloc reports all CPUs and NUMA nodes as allowed. Applications using hwloc for 
placement can therefore see resources outside their allowed set. Newer kernels 
(>= 6.16) built with CONFIG_PROC_PID_CPUSET=n can expose this path.

[ Test Plan ]
Use a cgroup v2 hierarchy with CPU and memory-node restrictions on an ancestor, 
and place the process in a descendant without effective cpuset files. Make 
/proc/self/cpuset unavailable. Compare hwloc's allowed CPU and node masks with 
the ancestor's effective masks. The membership path should remain unchanged in 
the LinuxCgroup metadata.

The upstream PR includes a synthetic fsroot fixture with four CPUs and
two NUMA nodes. The nearest ancestor permits CPUs 2-3 and node 1; the
process is in /parent/nearest/disabled/leaf. With a patched build of the
Noble source, lstopo reports allowed_cpuset=0x0000000c,
allowed_nodeset=0x00000002, and
LinuxCgroup=/parent/nearest/disabled/leaf. The upstream report says the
unpatched build reports all four CPUs and both nodes as allowed.

[ Where problems could occur ]
The change alters cpuset lookup for cgroup v2 when an effective mask file is 
missing. A wrong ancestor traversal could select a mask outside the process's 
cgroup subtree or incorrectly fall back to all resources.

Upstream fix: https://github.com/open-mpi/hwloc/pull/841

** Affects: hwloc (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: hwloc (Ubuntu Noble)
     Importance: Undecided
         Status: New

** Affects: hwloc (Ubuntu Resolute)
     Importance: Undecided
         Status: New

** Affects: hwloc (Ubuntu Stonking)
     Importance: Undecided
         Status: New

** Affects: hwloc (Ubuntu Tenacious)
     Importance: Undecided
         Status: New

** Also affects: hwloc (Ubuntu Tenacious)
   Importance: Undecided
       Status: New

** Also affects: hwloc (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: hwloc (Ubuntu Resolute)
   Importance: Undecided
       Status: New

** Also affects: hwloc (Ubuntu Stonking)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2171267

Title:
  hwloc ignores inherited cgroup v2 cpuset masks when leaf has no cpuset
  files

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/hwloc/+bug/2171267/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to