|
|
ecc5fe |
From d6dc1581c25221b17e1447f5eea0ee156a69e986 Mon Sep 17 00:00:00 2001
|
|
|
ecc5fe |
From: Joe Lawrence <joe.lawrence@redhat.com>
|
|
|
ecc5fe |
Date: Fri, 25 Mar 2022 14:49:39 -0400
|
|
|
ecc5fe |
Subject: [KPATCH CVE-2022-0492] cgroup-v1: kpatch fixes for CVE-2022-0492
|
|
|
ecc5fe |
Content-type: text/plain
|
|
|
ecc5fe |
|
|
|
ecc5fe |
Kernels:
|
|
|
ecc5fe |
3.10.0-1160.24.1.el7
|
|
|
ecc5fe |
3.10.0-1160.25.1.el7
|
|
|
ecc5fe |
3.10.0-1160.31.1.el7
|
|
|
ecc5fe |
3.10.0-1160.36.2.el7
|
|
|
ecc5fe |
3.10.0-1160.41.1.el7
|
|
|
ecc5fe |
3.10.0-1160.42.2.el7
|
|
|
ecc5fe |
3.10.0-1160.45.1.el7
|
|
|
ecc5fe |
3.10.0-1160.49.1.el7
|
|
|
ecc5fe |
3.10.0-1160.53.1.el7
|
|
|
ecc5fe |
3.10.0-1160.59.1.el7
|
|
|
ecc5fe |
|
|
|
ecc5fe |
Changes since last build:
|
|
|
ecc5fe |
arches: x86_64 ppc64le
|
|
|
ecc5fe |
cgroup.o: changed function: cgroup_release_agent_write
|
|
|
ecc5fe |
cgroup.o: changed function: parse_cgroupfs_options
|
|
|
ecc5fe |
---------------------------
|
|
|
ecc5fe |
|
|
|
ecc5fe |
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-7/-/merge_requests/36
|
|
|
ecc5fe |
Approved-by: Yannick Cote (@ycote1)
|
|
|
ecc5fe |
Modifications: none
|
|
|
ecc5fe |
|
|
|
ecc5fe |
commit a1d7f90e939b5ca2fddb1e295c6cf8bfb97a69f0
|
|
|
ecc5fe |
Author: Waiman Long <longman@redhat.com>
|
|
|
ecc5fe |
Date: Wed Feb 9 09:23:49 2022 -0500
|
|
|
ecc5fe |
|
|
|
ecc5fe |
cgroup-v1: Require capabilities to set release_agent
|
|
|
ecc5fe |
|
|
|
ecc5fe |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052162
|
|
|
ecc5fe |
CVE: CVE-2022-0492
|
|
|
ecc5fe |
Conflicts:
|
|
|
ecc5fe |
1) For RHEL7, the right file to be modified is kernel/cgroup.c.
|
|
|
ecc5fe |
2) The cgroup filesystem files in RHEL7 are created via direct
|
|
|
ecc5fe |
manipulation of dentries and inode and credential at the time of
|
|
|
ecc5fe |
creation are not stored. So the init_user_ns comparison check in
|
|
|
ecc5fe |
the upstream commit isn't applicable. It is also less important
|
|
|
ecc5fe |
and so the checks are dropped.
|
|
|
ecc5fe |
3) The cgroup mount parameter parsing is done in
|
|
|
ecc5fe |
parse_cgroupfs_options() instead.
|
|
|
ecc5fe |
|
|
|
ecc5fe |
commit 24f6008564183aa120d07c03d9289519c2fe02af
|
|
|
ecc5fe |
Author: Eric W. Biederman <ebiederm@xmission.com>
|
|
|
ecc5fe |
Date: Thu, 20 Jan 2022 11:04:01 -0600
|
|
|
ecc5fe |
|
|
|
ecc5fe |
cgroup-v1: Require capabilities to set release_agent
|
|
|
ecc5fe |
|
|
|
ecc5fe |
The cgroup release_agent is called with call_usermodehelper. The function
|
|
|
ecc5fe |
call_usermodehelper starts the release_agent with a full set fo capabilities.
|
|
|
ecc5fe |
Therefore require capabilities when setting the release_agaent.
|
|
|
ecc5fe |
|
|
|
ecc5fe |
Reported-by: Tabitha Sable <tabitha.c.sable@gmail.com>
|
|
|
ecc5fe |
Tested-by: Tabitha Sable <tabitha.c.sable@gmail.com>
|
|
|
ecc5fe |
Fixes: 81a6a5cdd2c5 ("Task Control Groups: automatic userspace notification of idle cgroups")
|
|
|
ecc5fe |
Cc: stable@vger.kernel.org # v2.6.24+
|
|
|
ecc5fe |
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
|
|
|
ecc5fe |
Signed-off-by: Tejun Heo <tj@kernel.org>
|
|
|
ecc5fe |
|
|
|
ecc5fe |
Signed-off-by: Waiman Long <longman@redhat.com>
|
|
|
ecc5fe |
|
|
|
ecc5fe |
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
|
|
|
ecc5fe |
---
|
|
|
ecc5fe |
kernel/cgroup.c | 15 +++++++++++++++
|
|
|
ecc5fe |
1 file changed, 15 insertions(+)
|
|
|
ecc5fe |
|
|
|
ecc5fe |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
|
|
|
ecc5fe |
index 4777d5bc3142..e4138e5a7879 100644
|
|
|
ecc5fe |
--- a/kernel/cgroup.c
|
|
|
ecc5fe |
+++ b/kernel/cgroup.c
|
|
|
ecc5fe |
@@ -1149,6 +1149,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
|
|
|
ecc5fe |
/* Specifying two release agents is forbidden */
|
|
|
ecc5fe |
if (opts->release_agent)
|
|
|
ecc5fe |
return -EINVAL;
|
|
|
ecc5fe |
+ /*
|
|
|
ecc5fe |
+ * Release agent gets called with all capabilities,
|
|
|
ecc5fe |
+ * require capabilities to set release agent.
|
|
|
ecc5fe |
+ */
|
|
|
ecc5fe |
+ if (!capable(CAP_SYS_ADMIN))
|
|
|
ecc5fe |
+ return -EPERM;
|
|
|
ecc5fe |
+
|
|
|
ecc5fe |
opts->release_agent =
|
|
|
ecc5fe |
kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
|
|
|
ecc5fe |
if (!opts->release_agent)
|
|
|
ecc5fe |
@@ -2196,6 +2203,14 @@ static int cgroup_release_agent_write(struct cgroup *cgrp, struct cftype *cft,
|
|
|
ecc5fe |
BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);
|
|
|
ecc5fe |
if (strlen(buffer) >= PATH_MAX)
|
|
|
ecc5fe |
return -EINVAL;
|
|
|
ecc5fe |
+
|
|
|
ecc5fe |
+ /*
|
|
|
ecc5fe |
+ * Release agent gets called with all capabilities,
|
|
|
ecc5fe |
+ * require capabilities to set release agent.
|
|
|
ecc5fe |
+ */
|
|
|
ecc5fe |
+ if (!capable(CAP_SYS_ADMIN))
|
|
|
ecc5fe |
+ return -EPERM;
|
|
|
ecc5fe |
+
|
|
|
ecc5fe |
if (!cgroup_lock_live_group(cgrp))
|
|
|
ecc5fe |
return -ENODEV;
|
|
|
ecc5fe |
mutex_lock(&cgroup_root_mutex);
|
|
|
ecc5fe |
--
|
|
|
ecc5fe |
2.26.3
|
|
|
ecc5fe |
|
|
|
ecc5fe |
|