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