From patchwork Tue Apr 30 03:26:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13648028 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8641314A9D; Tue, 30 Apr 2024 03:26:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714447572; cv=none; b=hOSeTyOX+Ur6ornCfuG2pnMWms1Qyxicxt/brB1j2hde8LKccXWtpkjFBLhwmADmC2ZejplERF5jjolYCWin7wwnh3GhcbjAdQXf7LbaPzo0FlfGy+iqootsjoLXdB4gtWrP81UGyRC5+ofNk/Roz39JJ+/roMkdJPybjqqqAZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714447572; c=relaxed/simple; bh=+ds/7/3UBAu0OEpN00hz3NyBHwkXI7mZPWEF2WP5LYo=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tdD1+szHvkhQhrafELSuJTQ4CxA8TOpd/rw2QSBffGtkuwfMQQPmR4uo+0mMlU2MZNkGI6FBgHtBtCbct42ixskrJi1PCl+yqEwjrtSzEpmzyHAZNGrvditdqQHKQgvQRuxxTkIZpEKbJ9UfIKe5mc0Ngx7rx7YPMe/GXT58ARk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W+iMhpio; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W+iMhpio" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 044D0C4AF18; Tue, 30 Apr 2024 03:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714447572; bh=+ds/7/3UBAu0OEpN00hz3NyBHwkXI7mZPWEF2WP5LYo=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=W+iMhpiof9qLcbnN+KtITRLOJxifuKPMAzwFFKauYWkWt+K4XsRI69rFcmzbjnRwS QDywIAvrAD5Z7B/pJ5+W5M9elDxEkxtdnsu9Wjbh4jksedAUGLkKRT/1GoOjM5Va3A cjIYIuqPiRPKorub4nqpIAtfJkC/R8tKeRnYtnFHPIG2FK8jDPHp5qdNwedKzemY/S OlgHBwZRVCaaefp17FS4bNr/NIBWl9I8eOaMf5eUsjTty4TuopmYMpCiea7mCF9ebI OmikbDnhZfjeHYKdoDl1rCzeqJr31Bmy9FC5O7NcMda7BBsJn3qS6E+I7FQLk+xNyt ELSFKdk66Y5TQ== Date: Mon, 29 Apr 2024 20:26:11 -0700 Subject: [PATCH 08/26] xfs: add fs-verity ro-compat flag From: "Darrick J. Wong" To: aalbersh@redhat.com, ebiggers@kernel.org, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, alexl@redhat.com, walters@verbum.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org Message-ID: <171444680498.957659.14212501134707828714.stgit@frogsfrogsfrogs> In-Reply-To: <171444680291.957659.15782417454902691461.stgit@frogsfrogsfrogs> References: <171444680291.957659.15782417454902691461.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Andrey Albershteyn To mark inodes with fs-verity enabled the new XFS_DIFLAG2_VERITY flag will be added in further patch. This requires ro-compat flag to let older kernels know that fs with fs-verity can not be modified. Signed-off-by: Andrey Albershteyn Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_format.h | 1 + fs/xfs/libxfs/xfs_sb.c | 2 ++ fs/xfs/xfs_mount.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index e9585ba12ded3..563f359f2f075 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -387,6 +387,7 @@ xfs_sb_has_compat_feature( #define XFS_SB_FEAT_RO_COMPAT_RMAPBT (1 << 1) /* reverse map btree */ #define XFS_SB_FEAT_RO_COMPAT_REFLINK (1 << 2) /* reflinked files */ #define XFS_SB_FEAT_RO_COMPAT_INOBTCNT (1 << 3) /* inobt block counts */ +#define XFS_SB_FEAT_RO_COMPAT_VERITY (1 << 4) /* fs-verity */ #define XFS_SB_FEAT_RO_COMPAT_ALL \ (XFS_SB_FEAT_RO_COMPAT_FINOBT | \ XFS_SB_FEAT_RO_COMPAT_RMAPBT | \ diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index ad64647234f44..0bf5b4007afd8 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -167,6 +167,8 @@ xfs_sb_version_to_features( features |= XFS_FEAT_REFLINK; if (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_INOBTCNT) features |= XFS_FEAT_INOBTCNT; + if (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_VERITY) + features |= XFS_FEAT_VERITY; if (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_FTYPE) features |= XFS_FEAT_FTYPE; if (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_SPINODES) diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index e44eef998477d..78284e91244a8 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -311,6 +311,7 @@ typedef struct xfs_mount { #define XFS_FEAT_EXCHANGE_RANGE (1ULL << 27) /* exchange range */ #define XFS_FEAT_METADIR (1ULL << 28) /* metadata directory tree */ #define XFS_FEAT_RTGROUPS (1ULL << 29) /* realtime groups */ +#define XFS_FEAT_VERITY (1ULL << 30) /* fs-verity */ /* Mount features */ #define XFS_FEAT_NOATTR2 (1ULL << 48) /* disable attr2 creation */ @@ -377,6 +378,7 @@ __XFS_HAS_FEAT(large_extent_counts, NREXT64) __XFS_HAS_FEAT(exchange_range, EXCHANGE_RANGE) __XFS_HAS_FEAT(metadir, METADIR) __XFS_HAS_FEAT(rtgroups, RTGROUPS) +__XFS_HAS_FEAT(verity, VERITY) static inline bool xfs_has_rtrmapbt(struct xfs_mount *mp) {