|
|
02818e |
From 1fab7a4d22151968645c995bc62580f40ae566ce Mon Sep 17 00:00:00 2001
|
|
|
02818e |
From: Julien Thierry <jthierry@redhat.com>
|
|
|
02818e |
Date: Fri, 2 Oct 2020 15:10:31 +0100
|
|
|
02818e |
Subject: [RHEL8.2 KPATCH] [fs] xfs: fix boundary test in xfs_attr_shortform_verify
|
|
|
02818e |
|
|
|
02818e |
Kernels:
|
|
|
02818e |
4.18.0-193.el8
|
|
|
02818e |
4.18.0-193.1.2.el8_2
|
|
|
02818e |
4.18.0-193.6.3.el8_2
|
|
|
02818e |
4.18.0-193.13.2.el8_2
|
|
|
02818e |
4.18.0-193.14.3.el8_2
|
|
|
02818e |
4.18.0-193.19.1.el8_2
|
|
|
02818e |
|
|
|
02818e |
Changes since last build:
|
|
|
02818e |
arches: x86_64 ppc64le
|
|
|
02818e |
xfs_attr_leaf.o: changed function: xfs_attr_shortform_verify
|
|
|
02818e |
---------------------------
|
|
|
02818e |
|
|
|
02818e |
Modifications:
|
|
|
02818e |
None
|
|
|
02818e |
|
|
|
02818e |
Testing: tried the commands in the commit message before and after the
|
|
|
02818e |
kpatch-patch. Without the kpatch-patch, the filesystem dies.
|
|
|
02818e |
|
|
|
02818e |
commit def0a18dc3b157ec347f018c1b367d8e4825dfca
|
|
|
02818e |
Author: Eric Sandeen <sandeen@redhat.com>
|
|
|
02818e |
Date: Thu Sep 10 16:10:27 2020 -0300
|
|
|
02818e |
|
|
|
02818e |
[fs] xfs: fix boundary test in xfs_attr_shortform_verify
|
|
|
02818e |
|
|
|
02818e |
Message-id: <5f3f90ef-7bec-6c66-8567-a2eb0a71a63c@redhat.com>
|
|
|
02818e |
Patchwork-id: 326142
|
|
|
02818e |
Patchwork-instance: patchwork
|
|
|
02818e |
O-Subject: [PATCH RHEL8.3] xfs: fix boundary test in xfs_attr_shortform_verify
|
|
|
02818e |
Bugzilla: 1875316
|
|
|
02818e |
Z-Bugzilla: 1881085
|
|
|
02818e |
CVE: CVE-2020-14385
|
|
|
02818e |
RH-Acked-by: Brian Foster <bfoster@redhat.com>
|
|
|
02818e |
RH-Acked-by: Vladis Dronov <vdronov@redhat.com>
|
|
|
02818e |
|
|
|
02818e |
Bugzilla: 1875316
|
|
|
02818e |
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
|
|
|
02818e |
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=31249120
|
|
|
02818e |
Tested: With simple reproducer in commit + xfstests
|
|
|
02818e |
CVE: CVE-2020-14385
|
|
|
02818e |
|
|
|
02818e |
The boundary test for the fixed-offset parts of xfs_attr_sf_entry in
|
|
|
02818e |
xfs_attr_shortform_verify is off by one, because the variable array
|
|
|
02818e |
at the end is defined as nameval[1] not nameval[].
|
|
|
02818e |
Hence we need to subtract 1 from the calculation.
|
|
|
02818e |
|
|
|
02818e |
This can be shown by:
|
|
|
02818e |
|
|
|
02818e |
# touch file
|
|
|
02818e |
# setfattr -n root.a file
|
|
|
02818e |
|
|
|
02818e |
and verifications will fail when it's written to disk.
|
|
|
02818e |
|
|
|
02818e |
This only matters for a last attribute which has a single-byte name
|
|
|
02818e |
and no value, otherwise the combination of namelen & valuelen will
|
|
|
02818e |
push endp further out and this test won't fail.
|
|
|
02818e |
|
|
|
02818e |
Fixes: 1e1bbd8e7ee06 ("xfs: create structure verifier function for shortform xattrs")
|
|
|
02818e |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
02818e |
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
02818e |
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
02818e |
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
|
|
02818e |
(cherry picked from commit f4020438fab05364018c91f7e02ebdd192085933)
|
|
|
02818e |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
02818e |
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
|
|
|
02818e |
|
|
|
02818e |
Signed-off-by: Julien Thierry <jthierry@redhat.com>
|
|
|
02818e |
---
|
|
|
02818e |
fs/xfs/libxfs/xfs_attr_leaf.c | 4 +++-
|
|
|
02818e |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
02818e |
|
|
|
02818e |
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
|
|
|
02818e |
index cbcc400f7634..7dbca5a14a90 100644
|
|
|
02818e |
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
|
|
|
02818e |
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
|
|
|
02818e |
@@ -949,8 +949,10 @@ xfs_attr_shortform_verify(
|
|
|
02818e |
* struct xfs_attr_sf_entry has a variable length.
|
|
|
02818e |
* Check the fixed-offset parts of the structure are
|
|
|
02818e |
* within the data buffer.
|
|
|
02818e |
+ * xfs_attr_sf_entry is defined with a 1-byte variable
|
|
|
02818e |
+ * array at the end, so we must subtract that off.
|
|
|
02818e |
*/
|
|
|
02818e |
- if (((char *)sfep + sizeof(*sfep)) >= endp)
|
|
|
02818e |
+ if (((char *)sfep + sizeof(*sfep) - 1) >= endp)
|
|
|
02818e |
return __this_address;
|
|
|
02818e |
|
|
|
02818e |
/* Don't allow names with known bad length. */
|
|
|
02818e |
--
|
|
|
02818e |
2.25.4
|