]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
src/systemd: check for ctrl name in scope name
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 22 Aug 2023 06:34:13 +0000 (12:04 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 30 Aug 2023 20:32:55 +0000 (14:32 -0600)
commit13729c712694103ec10487cf8d7c9f53bbded280
tree950a3cf54aae74e955eb292773538d90b657f1d0
parent444159e29c5323bdcb42d8bd3900f5516dffaead
src/systemd: check for ctrl name in scope name

systemd will silently prefix a '_' to the scope name and create, and
delegate it under the slice. If it matches with any of the original
cgroup and pseudo BPF-base systemd controllers. i.e.,

 # cgcreate -c -g cpuset,cpu:oracle.slice/cpuset.scope
 # tree /sys/fs/cgroup/oracle.slice/ -d
 /sys/fs/cgroup/oracle.slice/
 ├── _cpuset.scope
 └── cpuset.scope

 2 directories

 # systemd-cgls /oracle.slice
 Control group /oracle.slice:
 └─cpuset.scope …
   └─969 libcgroup_systemd_idle_thread

 # cat /proc/969/cgroup
 0::/oracle.slice/_cpuset.scope

this implicit rename will cause confusion to the users, who would not
see any errors during creation but operate on non-delegated cgroup scope
created by libcgroup internally. Disallow such systemd scope names.

Reported-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/systemd.c