]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
fix: cgroupv2_subtree_control_recursive(): test before writing
authorAdriaan Schmidt <adriaan.schmidt@siemens.com>
Tue, 2 Apr 2024 12:55:46 +0000 (14:55 +0200)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 15 Apr 2024 19:24:36 +0000 (13:24 -0600)
commit73a8992e9f61f2a85ff78a38a8e51fe45f1711cc
tree2d42a11b4e4438d36458e9979c5b1e5f7ef45fe3
parent688de5ad287d74f1bee34e6bfa4ab42d949d4485
fix: cgroupv2_subtree_control_recursive(): test before writing

cgroupv2_subtree_control_recursive() writes to subtree_control
files in the cgroup tree, starting at the root cgroup. As the
root cgroup is managed by SystemD, its control files belong to the
root user.
This new check ensures that we only attempt to write to subtree_control
if the desired controller is not already active (e.g., because we're
using SystemD Delegation mechanisms), thus better enabling cgroup
manipulations for non-root users.

Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/api.c