Blame SOURCES/CVE-2021-4155.patch

970b9f
From cec4ee812b7c642c552c64c488a299323d622638 Mon Sep 17 00:00:00 2001
970b9f
From: Joe Lawrence <joe.lawrence@redhat.com>
970b9f
Date: Fri, 7 Jan 2022 14:11:20 -0500
970b9f
Subject: [KPATCH CVE-2021-4155] xfs: kpatch fixes for CVE-2021-4155
970b9f
970b9f
Kernels:
970b9f
4.18.0-348.el8
970b9f
4.18.0-348.2.1.el8_5
970b9f
4.18.0-348.7.1.el8_5
970b9f
970b9f
Changes since last build:
970b9f
arches: x86_64 ppc64le
970b9f
xfs_ioctl.o: changed function: xfs_ioc_space
970b9f
---------------------------
970b9f
970b9f
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-8/-/merge_requests/12
970b9f
Approved-by: Artem Savkov (@artem.savkov)
970b9f
Kernels:
970b9f
4.18.0-348.el8
970b9f
4.18.0-348.2.1.el8_5
970b9f
4.18.0-348.7.1.el8_5
970b9f
970b9f
Modifications: none
970b9f
970b9f
Z-MR: https://gitlab.com/redhat/prdsc/rhel/src/kernel-private/rhel-8/-/merge_requests/28
970b9f
970b9f
KT0 test PASS: https://beaker.engineering.redhat.com/jobs/6173055
970b9f
for kpatch-patch-4_18_0-348-1-2.el8 scratch build:
970b9f
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=42267085
970b9f
970b9f
commit 374251004418783ae2e1e191b957cf63e3796d5e
970b9f
Author: Bruno Meneguele <bmeneg@redhat.com>
970b9f
Date:   Thu Jan 6 17:19:24 2022 -0300
970b9f
970b9f
    xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate
970b9f
970b9f
    Bugzilla: https://bugzilla.redhat.com/2034864
970b9f
    CVE: CVE-2021-4155
970b9f
970b9f
    O-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034865
970b9f
    O-CVE: CVE-2021-4155
970b9f
    Tested: xfstests and specific reproducer
970b9f
    Upstream status: Posted privately due to embargo
970b9f
970b9f
    The old ALLOCSP/FREESP ioctls in XFS can be used to preallocate space at
970b9f
    the end of files, just like fallocate and RESVSP.  Make the behavior
970b9f
    consistent with the other ioctls.
970b9f
970b9f
    Reported-by: Kirill Tkhai <ktkhai@virtuozzo.com>
970b9f
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
970b9f
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
970b9f
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
970b9f
    Reviewed-by: Eric Sandeen <sandeen@redhat.com>
970b9f
    (cherry picked from commit 983d8e60f50806f90534cc5373d0ce867e5aaf79)
970b9f
970b9f
    Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
970b9f
    Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
970b9f
970b9f
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
970b9f
---
970b9f
 fs/xfs/xfs_ioctl.c | 3 ++-
970b9f
 1 file changed, 2 insertions(+), 1 deletion(-)
970b9f
970b9f
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
970b9f
index 2a68819e4fe5..7d9c76c5cfb0 100644
970b9f
--- a/fs/xfs/xfs_ioctl.c
970b9f
+++ b/fs/xfs/xfs_ioctl.c
970b9f
@@ -686,7 +686,8 @@ xfs_ioc_space(
970b9f
 
970b9f
 	if (bf->l_start > XFS_ISIZE(ip)) {
970b9f
 		error = xfs_alloc_file_space(ip, XFS_ISIZE(ip),
970b9f
-				bf->l_start - XFS_ISIZE(ip), 0);
970b9f
+				bf->l_start - XFS_ISIZE(ip),
970b9f
+				XFS_BMAPI_PREALLOC);
970b9f
 		if (error)
970b9f
 			goto out_unlock;
970b9f
 	}
970b9f
-- 
970b9f
2.26.3
970b9f
970b9f