]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
cgroup-v1: Correct privileges check in release_agent writes
authorMichal Koutný <mkoutny@suse.com>
Thu, 17 Feb 2022 16:11:28 +0000 (17:11 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 7 Mar 2022 10:45:52 +0000 (11:45 +0100)
commit28aa44d52aab68606e51468109f6de4235b35a30
tree6860549743f0867cb1ddef2f6400e9324a47513d
parentc89b79c6835b317a3590239843acb616f56f2a05
cgroup-v1: Correct privileges check in release_agent writes

BugLink: https://bugs.launchpad.net/bugs/1963891
commit 467a726b754f474936980da793b4ff2ec3e382a7 upstream.

The idea is to check: a) the owning user_ns of cgroup_ns, b)
capabilities in init_user_ns.

The commit 24f600856418 ("cgroup-v1: Require capabilities to set
release_agent") got this wrong in the write handler of release_agent
since it checked user_ns of the opener (may be different from the owning
user_ns of cgroup_ns).
Secondly, to avoid possibly confused deputy, the capability of the
opener must be checked.

Fixes: 24f600856418 ("cgroup-v1: Require capabilities to set release_agent")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/stable/20220216121142.GB30035@blackbody.suse.cz/
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Reviewed-by: Masami Ichikawa(CIP) <masami.ichikawa@cybertrust.co.jp>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
kernel/cgroup/cgroup-v1.c