From patchwork Tue Aug 21 17:59:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 960677 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Mmqen02r"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41vz4S1pDfz9s4Z for ; Wed, 22 Aug 2018 04:00:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726849AbeHUVWE (ORCPT ); Tue, 21 Aug 2018 17:22:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:53208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726628AbeHUVWE (ORCPT ); Tue, 21 Aug 2018 17:22:04 -0400 Received: from ebiggers-linuxstation.kir.corp.google.com (unknown [104.132.51.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 064F821473; Tue, 21 Aug 2018 18:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1534874455; bh=G6l7GkuFs1pGJFJoUbh8nWfouyswfRYN4VkMunU2Hy4=; h=From:To:Subject:Date:From; b=Mmqen02rt0prc5q1OwytmA+wBJypdyfJo9u1XG+7XlRuRY9bX4CyoS/HNw698Zs/n GQFxp+A0yZ8WEqYYTSh7iB018Ym+LoBnnrFtPyzgOGw9iTTpQe7YDMjMbJNUB4yISF ZMQYPKBHmyWIZD/6l9p+l2K5JfujyM0MxyoIOkbE= From: Eric Biggers To: Theodore Ts'o , linux-ext4@vger.kernel.org Subject: [PATCH] e2fsck: allow verity files to have initialized blocks past i_size Date: Tue, 21 Aug 2018 10:59:37 -0700 Message-Id: <20180821175937.155466-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.18.0.865.gffc8e1a3cd6-goog MIME-Version: 1.0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers 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 --- e2fsck/pass1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index ce43821d..8abf0c33 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])