Perhaps what you should to be arguing then that the default
permissions of the cgroup directories need to be all rwx for
everyone and then your patch becomes unnecessary?
I don't think that would be the nicest way of dealing with this
(then a process can make very large numbers of cgroups all over
the tree, which might not cause huge issues but would still be a
pain for administrators and systemds alike).
Beware of what you cite as a problem. Any user can enter a user
namespace and then unshare a cgroup namespace. This means that
what you seem to want is equivalent to any user at all being able
to create a cgroup hierarchy.
They should only be allowed to make subtrees of the cgroup *they
currently reside in* IMO.
For the usual case that is the top level cgroup because most processes
don't get initially confined. If there is initial confinement by
something, then whatever it is could alter the permissions as well.
So if the default case is equivalent to making all the initial top
level cgroups rwx, we should understand the implications of that and
the best way to concentrate minds is to ask what happens if it were the
default.
If we decide to implement both, we have to agree on the restrictions
*immediately* because the cgroup namespace was merged in 4.6-rc1 so
changing the restrictions on it in 4.7 would probably be frowned
upon.
No, that horse has left the stable: the cgroup namespace applies to
both v1 and v2.
My thinking was that rename(2) would make this a simple decision, but
I just realised that rename(2) doesn't let you change the hierarchy.
But it should be noted that cgroupv2 has a fix for this: you can't
move a task to another cgroup unless you have attach rights
(cgroup.procs) to the common ancestor of the current cgroup and the
target cgroup.
Currently the decision is made in cgroup_procs_write_permission() and
actually is blind to the user namespace, so this needs updating anyway.