linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e2fsck: handle verity files in scan_extent_node()
@ 2019-05-23 15:30 Eric Biggers
  2019-05-24  4:33 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2019-05-23 15:30 UTC (permalink / raw)
  To: linux-ext4

From: Eric Biggers <ebiggers@google.com>

Don't report PR_1_EXTENT_END_OUT_OF_BOUNDS on verity files during
scan_extent_node(), since they will have blocks stored past i_size.

This was missed during the earlier fix because this check only triggers
if the inode has enough extents to need at least one extent index node.

This bug is causing one of the fs-verity xfstests to fail with the
reworked fs-verity patchset.

Fixes: 3baafde6a8ae ("e2fsck: allow verity files to have initialized blocks past i_size")
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 e2fsck/pass1.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 5c413610..524577ae 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -2812,8 +2812,9 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
 		else if (extent.e_lblk < start_block)
 			problem = PR_1_OUT_OF_ORDER_EXTENTS;
 		else if ((end_block && last_lblk > end_block) &&
-			 (!(extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT &&
-				last_lblk > eof_block)))
+			 !(last_lblk > eof_block &&
+			   ((extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT) ||
+			    (pctx->inode->i_flags & EXT4_VERITY_FL))))
 			problem = PR_1_EXTENT_END_OUT_OF_BOUNDS;
 		else if (is_leaf && extent.e_len == 0)
 			problem = PR_1_EXTENT_LENGTH_ZERO;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] e2fsck: handle verity files in scan_extent_node()
  2019-05-23 15:30 [PATCH] e2fsck: handle verity files in scan_extent_node() Eric Biggers
@ 2019-05-24  4:33 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2019-05-24  4:33 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-ext4

On Thu, May 23, 2019 at 08:30:33AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Don't report PR_1_EXTENT_END_OUT_OF_BOUNDS on verity files during
> scan_extent_node(), since they will have blocks stored past i_size.
> 
> This was missed during the earlier fix because this check only triggers
> if the inode has enough extents to need at least one extent index node.
> 
> This bug is causing one of the fs-verity xfstests to fail with the
> reworked fs-verity patchset.
> 
> Fixes: 3baafde6a8ae ("e2fsck: allow verity files to have initialized blocks past i_size")
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied.

Could you supply a small (~200k) file system with a verity-protected
file so we can add a regression test?  Many thanks!!

     	       	     		       	    - Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-24  4:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 15:30 [PATCH] e2fsck: handle verity files in scan_extent_node() Eric Biggers
2019-05-24  4:33 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).