From: Theodore Ts'o Date: Tue, 21 Aug 2018 20:27:51 +0000 (-0400) Subject: Cherry-pick "e2fsck: allow verity files to have initialized blocks past i_size" X-Git-Tag: debian/1.44.4-2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6155f314928a21d9d1c645758cd394988a9d1785;p=thirdparty%2Fe2fsprogs.git Cherry-pick "e2fsck: allow verity files to have initialized blocks past i_size" Signed-off-by: Theodore Ts'o --- diff --git a/debian/patches/0004-e2fsck-allow-verity-files-to-have-initialized-blocks.patch b/debian/patches/0004-e2fsck-allow-verity-files-to-have-initialized-blocks.patch new file mode 100644 index 000000000..7aa7c665b --- /dev/null +++ b/debian/patches/0004-e2fsck-allow-verity-files-to-have-initialized-blocks.patch @@ -0,0 +1,32 @@ +From: Eric Biggers +Date: Tue, 21 Aug 2018 10:59:37 -0700 +Subject: e2fsck: allow verity files to have initialized blocks past i_size + +Since ext4 verity is going to be an RO_COMPAT feature rather than an +INCOMPAT one, the on-disk i_size of verity inodes needs to be the data +size rather than the full size. Consequently, verity inodes will have +initialized blocks past i_size, containing the Merkle tree and other +verity metadata. So e2fsck must not fix the i_size of such inodes as it +normally would. + +Signed-off-by: Eric Biggers +Signed-off-by: Theodore Ts'o +Origin: Upstream, https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?h=maint&id=3baafde6a8ae +--- + e2fsck/pass1.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c +index ce43821..8abf0c3 100644 +--- a/e2fsck/pass1.c ++++ b/e2fsck/pass1.c +@@ -3447,7 +3447,8 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, + size = EXT2_I_SIZE(inode); + if ((pb.last_init_lblock >= 0) && + /* Do not allow initialized allocated blocks past i_size*/ +- (size < (__u64)pb.last_init_lblock * fs->blocksize)) ++ (size < (__u64)pb.last_init_lblock * fs->blocksize) && ++ !(inode->i_flags & EXT4_VERITY_FL)) + bad_size = 3; + else if (!(extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) && + size > ext2_max_sizes[fs->super->s_log_block_size]) diff --git a/debian/patches/series b/debian/patches/series index cf2dd7dc9..e179103b9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 0001-tune2fs-fix-dereference-of-freed-memory-after-journa.patch 0002-libe2p-fix-verity-flag-bit.patch 0003-libext2fs-add-verity-flag-to-EXT2_LIB_FEATURE_RO_COM.patch +0004-e2fsck-allow-verity-files-to-have-initialized-blocks.patch