Whamcloud - gitweb
LU-11790 ldiskfs: add terminating u32 when expanding inodes 70/34270/2
authorLi Dongyang <dongyangli@ddn.com>
Wed, 19 Dec 2018 03:03:14 +0000 (14:03 +1100)
committerOleg Drokin <green@whamcloud.com>
Sat, 23 Feb 2019 05:10:21 +0000 (05:10 +0000)
In ext4_expand_extra_isize_ea(), we calculate the total size of the
xattr header, plus the xattr entries so we know how much of the
beginning part of the xattrs to move when expanding the inode extra
size.  We need to include the terminating u32 at the end of the xattr
entries, or else if there is uninitialized, non-zero bytes after the
xattr entries and before the xattr values, the list of xattr entries
won't be properly terminated.

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: I247b935b3cf315481dc4658133a7eee02b6350e9
Lustre-change: https://review.whamcloud.com/33893
Lustre-commit: 7c800e460661972925a7acab51f023d0b38161b5
Tested-by: Jenkins
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/34270
Tested-by: Maloo <maloo@whamcloud.com>
23 files changed:
ldiskfs/kernel_patches/patches/rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/ubuntu18/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.4.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.5.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.6.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.7.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.8.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.9.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series
ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11.series
ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series
ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp4.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.3.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.4.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.5.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.6.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.series
ldiskfs/kernel_patches/series/ldiskfs-3.12-sles12.series
ldiskfs/kernel_patches/series/ldiskfs-3.12-sles12sp1.series
ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series
ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp3.series

diff --git a/ldiskfs/kernel_patches/patches/rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch b/ldiskfs/kernel_patches/patches/rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
new file mode 100644 (file)
index 0000000..4276336
--- /dev/null
@@ -0,0 +1,31 @@
+Date: Fri, 14 Dec 2018 22:43:43 -0500
+From: "Theodore Ts'o" <tytso@mit.edu>
+List-Id: <linux-ext4.vger.kernel.org>
+
+In ext4_expand_extra_isize_ea(), we calculate the total size of the
+xattr header, plus the xattr entries so we know how much of the
+beginning part of the xattrs to move when expanding the inode extra
+size.  We need to include the terminating u32 at the end of the xattr
+entries, or else if there is uninitialized, non-zero bytes after the
+xattr entries and before the xattr values, the list of xattr entries
+won't be properly terminated.
+
+Reported-by: Steve Graham <stgraham2000@gmail.com>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+---
+ fs/ext4/xattr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: linux-3.10.0-862.14.4.el7/fs/ext4/xattr.c
+===================================================================
+--- linux-3.10.0-862.14.4.el7.orig/fs/ext4/xattr.c
++++ linux-3.10.0-862.14.4.el7/fs/ext4/xattr.c
+@@ -1628,7 +1628,7 @@ retry:
+       end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
+       min_offs = end - base;
+       last = entry;
+-      total_ino = sizeof(struct ext4_xattr_ibody_header);
++      total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32);
+       ifree = ext4_xattr_free_space(last, &min_offs, base, &total_ino);
+       if (ifree >= isize_diff)
diff --git a/ldiskfs/kernel_patches/patches/ubuntu18/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch b/ldiskfs/kernel_patches/patches/ubuntu18/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
new file mode 100644 (file)
index 0000000..3cfbba8
--- /dev/null
@@ -0,0 +1,31 @@
+Date: Fri, 14 Dec 2018 22:43:43 -0500
+From: "Theodore Ts'o" <tytso@mit.edu>
+List-Id: <linux-ext4.vger.kernel.org>
+
+In ext4_expand_extra_isize_ea(), we calculate the total size of the
+xattr header, plus the xattr entries so we know how much of the
+beginning part of the xattrs to move when expanding the inode extra
+size.  We need to include the terminating u32 at the end of the xattr
+entries, or else if there is uninitialized, non-zero bytes after the
+xattr entries and before the xattr values, the list of xattr entries
+won't be properly terminated.
+
+Reported-by: Steve Graham <stgraham2000@gmail.com>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+---
+ fs/ext4/xattr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
+index 7fddd519adae..86ed9c686249 100644
+--- a/fs/ext4/xattr.c
++++ b/fs/ext4/xattr.c
+@@ -2722,7 +2722,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
+       base = IFIRST(header);
+       end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
+       min_offs = end - base;
+-      total_ino = sizeof(struct ext4_xattr_ibody_header);
++      total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32);
+       error = xattr_check_inode(inode, header, end);
+       if (error)
index abf90a6..1431e2a 100644 (file)
@@ -45,3 +45,4 @@ rhel6.3/ext4-notalloc_under_idatasem.patch
 rhel6.3/ext4-dont-check-in-ro.patch
 rhel6.3/ext4-dont-check-before-replay.patch
 rhel6.3/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 970bf52..0253fe2 100644 (file)
@@ -49,3 +49,4 @@ rhel6.3/ext4-dont-check-in-ro.patch
 rhel6.3/ext4-dont-check-before-replay.patch
 rhel6.5/ext4-brackets-in-ext4-remove-blocks.patch
 rhel6.3/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 4180e13..ebc9b20 100644 (file)
@@ -49,3 +49,4 @@ rhel6.6/ext4_s_max_ext_tree_depth.patch
 rhel6.5/ext4-fix-journal-quota.patch
 rhel6.5/ext4-brackets-in-ext4-remove-blocks.patch
 rhel6.6/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 015fef2..ce489cc 100644 (file)
@@ -48,3 +48,4 @@ rhel6.6/ext4_s_max_ext_tree_depth.patch
 rhel6.5/ext4-fix-journal-quota.patch
 rhel6.5/ext4-brackets-in-ext4-remove-blocks.patch
 rhel6.6/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index f1ae10d..8a3618c 100644 (file)
@@ -46,3 +46,4 @@ rhel6.6/ext4_s_max_ext_tree_depth.patch
 rhel6.5/ext4-fix-journal-quota.patch
 rhel6.5/ext4-brackets-in-ext4-remove-blocks.patch
 rhel6.6/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index f4f0a3d..ca6be8d 100644 (file)
@@ -45,3 +45,4 @@ rhel6.5/ext4-give-warning-with-dir-htree-growing.patch
 rhel6.6/ext4_s_max_ext_tree_depth.patch
 rhel6.5/ext4-fix-journal-quota.patch
 rhel6.6/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 862ee3c..a03fd24 100644 (file)
@@ -44,3 +44,4 @@ rhel6.3/ext4-notalloc_under_idatasem.patch
 rhel6.3/ext4-dont-check-in-ro.patch
 rhel6.3/ext4-dont-check-before-replay.patch
 rhel6.3/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index c692f10..283e25b 100644 (file)
@@ -44,3 +44,4 @@ rhel6.3/ext4-recalc-percpu-counters-after-journal.patch
 rhel6.3/ext4-notalloc_under_idatasem.patch
 rhel6.5/ext4-fix-journal-quota.patch
 rhel6.3/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 1961d04..dc38227 100644 (file)
@@ -40,3 +40,4 @@ sles11sp3/ext4_s_max_ext_tree_depth.patch
 sles11sp1/ext4-notalloc_under_idatasem.patch
 rhel6.5/ext4-fix-journal-quota.patch
 sles11sp2/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 53c2d10..6627c79 100644 (file)
@@ -44,3 +44,4 @@ rhel6.5/ext4-fix-journal-quota.patch
 sles11sp3/ext4-dont-check-before-replay.patch
 rhel6.3/ext4-dont-check-in-ro.patch
 sles11sp2/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index e15b624..3cf61cc 100644 (file)
@@ -44,3 +44,4 @@ rhel6.5/ext4-fix-journal-quota.patch
 sles11sp3/ext4-dont-check-before-replay.patch
 rhel6.3/ext4-dont-check-in-ro.patch
 sles11sp2/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 6a38507..63a1665 100644 (file)
@@ -34,3 +34,4 @@ rhel7/ext4-cleanup-goto-next-group.patch
 rhel7/ext4-reduce-lock-contention-in-__ext4_new_inode.patch
 rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 0974e8b..7cd4d35 100644 (file)
@@ -34,3 +34,4 @@ rhel7/ext4-cleanup-goto-next-group.patch
 rhel7/ext4-reduce-lock-contention-in-__ext4_new_inode.patch
 rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 32c88ca..feeda41 100644 (file)
@@ -34,3 +34,4 @@ rhel7/ext4-cleanup-goto-next-group.patch
 rhel7/ext4-reduce-lock-contention-in-__ext4_new_inode.patch
 rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index ca60820..9df247a 100644 (file)
@@ -31,3 +31,4 @@ rhel6.3/ext4-dont-check-in-ro.patch
 rhel7.4/ext4-dont-check-before-replay.patch
 rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index e83274b..0a04968 100644 (file)
@@ -31,3 +31,4 @@ rhel6.3/ext4-dont-check-in-ro.patch
 rhel7.6/ext4-dont-check-before-replay.patch
 rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 835a23c..6563ac8 100644 (file)
@@ -30,3 +30,4 @@ rhel7/ext4-fix-xattr-shifting-when-expanding-inodes.patch
 rhel7/ext4-cleanup-goto-next-group.patch
 rhel7/ext4-reduce-lock-contention-in-__ext4_new_inode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index bcc0216..96e9735 100644 (file)
@@ -21,3 +21,4 @@ rhel7/ext4-give-warning-with-dir-htree-growing.patch
 rhel7/ext4-mmp-brelse.patch
 rhel7/ext4-jcb-optimization.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 4b622a8..5be3614 100644 (file)
@@ -22,3 +22,4 @@ rhel7/ext4-mmp-brelse.patch
 rhel7/ext4-jcb-optimization.patch
 sles12sp1/ext4-attach-jinode-in-writepages.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index f2e6460..e5e638c 100644 (file)
@@ -26,3 +26,4 @@ rhel7.2/ext4-dont-check-in-ro.patch
 sles12sp2/ext4-fix-xattr-shifting-when-expanding-inodes.patch
 rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
index 33cabd6..001d035 100644 (file)
@@ -26,3 +26,4 @@ rhel7.2/ext4-dont-check-in-ro.patch
 sles12sp2/ext4-fix-xattr-shifting-when-expanding-inodes.patch
 rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
 rhel7/ext4-mmp-dont-mark-bh-dirty.patch
+rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch