Blame SOURCES/CVE-2021-4155.patch

c6ac4c
From 01df9f93baafe0243264cf24f42d84e124c9ee0a Mon Sep 17 00:00:00 2001
c6ac4c
From: Joe Lawrence <joe.lawrence@redhat.com>
c6ac4c
Date: Tue, 4 Jan 2022 13:53:44 -0500
c6ac4c
Subject: [KPATCH CVE-2021-4155] xfs: kpatch fixes for CVE-2021-4155
c6ac4c
c6ac4c
Kernels:
c6ac4c
3.10.0-1160.15.2.el7
c6ac4c
3.10.0-1160.21.1.el7
c6ac4c
3.10.0-1160.24.1.el7
c6ac4c
3.10.0-1160.25.1.el7
c6ac4c
3.10.0-1160.31.1.el7
c6ac4c
3.10.0-1160.36.2.el7
c6ac4c
3.10.0-1160.41.1.el7
c6ac4c
3.10.0-1160.42.2.el7
c6ac4c
3.10.0-1160.45.1.el7
c6ac4c
3.10.0-1160.49.1.el7
c6ac4c
3.10.0-1160.53.1.el7
c6ac4c
c6ac4c
Changes since last build:
c6ac4c
arches: x86_64 ppc64le
c6ac4c
xfs_ioctl.o: changed function: xfs_ioc_space
c6ac4c
---------------------------
c6ac4c
c6ac4c
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-7/-/merge_requests/15
c6ac4c
Approved-by: Yannick Cote (@ycote1)
c6ac4c
Approved-by: Artem Savkov (@artem.savkov)
c6ac4c
Kernels:
c6ac4c
3.10.0-1160.21.1.el7
c6ac4c
3.10.0-1160.24.1.el7
c6ac4c
3.10.0-1160.25.1.el7
c6ac4c
3.10.0-1160.31.1.el7
c6ac4c
3.10.0-1160.36.2.el7
c6ac4c
3.10.0-1160.41.1.el7
c6ac4c
3.10.0-1160.42.2.el7
c6ac4c
3.10.0-1160.45.1.el7
c6ac4c
3.10.0-1160.49.1.el7
c6ac4c
3.10.0-1160.53.1.el7
c6ac4c
c6ac4c
Modifications: none
c6ac4c
c6ac4c
Z-MR: https://gitlab.com/redhat/prdsc/rhel/src/kernel-private/rhel-7/-/merge_requests/18
c6ac4c
c6ac4c
KT0 test PASS: https://beaker.engineering.redhat.com/jobs/6164756
c6ac4c
for kpatch-patch-3_10_0-1160_15_2-1-11.el7 scratch build:
c6ac4c
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=42181339
c6ac4c
c6ac4c
commit 65cb42abca9a5a600cbbdbbef8ddbafd028b7b5d
c6ac4c
Author: Carlos Maiolino <cmaiolino@redhat.com>
c6ac4c
Date:   Tue Jan 4 08:29:12 2022 +0100
c6ac4c
c6ac4c
    xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate
c6ac4c
c6ac4c
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034857
c6ac4c
    CVE: CVE-2021-4155
c6ac4c
    Tested: xfstests and specific reproducer
c6ac4c
    Upstream status: Posted privately due to embargo
c6ac4c
c6ac4c
    Conflicts:
c6ac4c
            - el7 required small adjustment to the patch, to fit the old
c6ac4c
              code.
c6ac4c
c6ac4c
    The old ALLOCSP/FREESP ioctls in XFS can be used to preallocate space at
c6ac4c
    the end of files, just like fallocate and RESVSP.  Make the behavior
c6ac4c
    consistent with the other ioctls.
c6ac4c
c6ac4c
    Reported-by: Kirill Tkhai <ktkhai@virtuozzo.com>
c6ac4c
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
c6ac4c
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
c6ac4c
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
c6ac4c
    Reviewed-by: Eric Sandeen <sandeen@redhat.com>
c6ac4c
    (cherry picked from commit 983d8e60f50806f90534cc5373d0ce867e5aaf79)
c6ac4c
c6ac4c
    Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
c6ac4c
c6ac4c
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
c6ac4c
---
c6ac4c
 fs/xfs/xfs_ioctl.c | 3 ++-
c6ac4c
 1 file changed, 2 insertions(+), 1 deletion(-)
c6ac4c
c6ac4c
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
c6ac4c
index 722396680482..8f1c795c8765 100644
c6ac4c
--- a/fs/xfs/xfs_ioctl.c
c6ac4c
+++ b/fs/xfs/xfs_ioctl.c
c6ac4c
@@ -773,7 +773,8 @@ xfs_ioc_space(
c6ac4c
 		flags |= XFS_PREALLOC_CLEAR;
c6ac4c
 		if (bf->l_start > XFS_ISIZE(ip)) {
c6ac4c
 			error = xfs_alloc_file_space(ip, XFS_ISIZE(ip),
c6ac4c
-					bf->l_start - XFS_ISIZE(ip), 0);
c6ac4c
+					bf->l_start - XFS_ISIZE(ip),
c6ac4c
+					XFS_BMAPI_PREALLOC);
c6ac4c
 			if (error)
c6ac4c
 				goto out_unlock;
c6ac4c
 		}
c6ac4c
-- 
c6ac4c
2.26.3
c6ac4c
c6ac4c