Blame SOURCES/CVE-2022-0185.patch

cdd3f9
From 84e2346b7ae9c50f95701027f8d860424623a294 Mon Sep 17 00:00:00 2001
cdd3f9
From: Joe Lawrence <joe.lawrence@redhat.com>
cdd3f9
Date: Fri, 14 Jan 2022 09:25:24 -0500
cdd3f9
Subject: [KPATCH CVE-2022-0185] vfs: kpatch fixes for CVE-2022-0185
cdd3f9
cdd3f9
Kernels:
cdd3f9
4.18.0-348.el8
cdd3f9
4.18.0-348.2.1.el8_5
cdd3f9
4.18.0-348.7.1.el8_5
cdd3f9
cdd3f9
Changes since last build:
cdd3f9
arches: x86_64 ppc64le
cdd3f9
fs_context.o: changed function: legacy_parse_param
cdd3f9
---------------------------
cdd3f9
cdd3f9
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-8/-/merge_requests/15
cdd3f9
Approved-by: Artem Savkov (@artem.savkov)
cdd3f9
Kernels:
cdd3f9
4.18.0-348.el8
cdd3f9
4.18.0-348.2.1.el8_5
cdd3f9
4.18.0-348.7.1.el8_5
cdd3f9
cdd3f9
Modifications: none
cdd3f9
cdd3f9
commit 689263a917cde581464bdc69777dd0f3d9e808af
cdd3f9
Author: Frantisek Hrbata <fhrbata@redhat.com>
cdd3f9
Date:   Fri Jan 14 10:30:05 2022 +0100
cdd3f9
cdd3f9
    vfs: Out-of-bounds write of heap buffer in fs_context.c
cdd3f9
cdd3f9
    Bugzilla: https://bugzilla.redhat.com/2040585
cdd3f9
    CVE: CVE-2022-0185
cdd3f9
cdd3f9
    From Jamie Hill-Daniel <jamie@hill-daniel.co.uk>
cdd3f9
cdd3f9
    The "PAGE_SIZE - 2 - size" calculation is is an unsigned type so
cdd3f9
    a large value of "size" results in a high positive value. This
cdd3f9
    results in heap overflow which can be exploited by a standard
cdd3f9
    user for privilege escalation.
cdd3f9
cdd3f9
    Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
cdd3f9
cdd3f9
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
cdd3f9
---
cdd3f9
 fs/fs_context.c | 6 ++++--
cdd3f9
 1 file changed, 4 insertions(+), 2 deletions(-)
cdd3f9
cdd3f9
diff --git a/fs/fs_context.c b/fs/fs_context.c
cdd3f9
index b1eacb03b72f..c921102b2398 100644
cdd3f9
--- a/fs/fs_context.c
cdd3f9
+++ b/fs/fs_context.c
cdd3f9
@@ -563,8 +563,10 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
cdd3f9
 		return invalf(fc, "VFS: Legacy: Parameter type for '%s' not supported",
cdd3f9
 			      param->key);
cdd3f9
 	}
cdd3f9
-
cdd3f9
-	if (len > PAGE_SIZE - 2 - size)
cdd3f9
+	/* Subtracting 'size' from PAGE_SIZE can lead to integer underflow,
cdd3f9
+	 * so check bounds using addition instead.
cdd3f9
+	 */
cdd3f9
+	if (size + len + 2 > PAGE_SIZE)
cdd3f9
 		return invalf(fc, "VFS: Legacy: Cumulative options too large");
cdd3f9
 	if (strchr(param->key, ',') ||
cdd3f9
 	    (param->type == fs_value_is_string &&
cdd3f9
-- 
cdd3f9
2.26.3
cdd3f9
cdd3f9