Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6105630rwl; Tue, 4 Apr 2023 07:58:05 -0700 (PDT) X-Google-Smtp-Source: AKy350bQHODnu5PJSA97xPmG0NtCVYAazSP/7TeS9aqWPkrs08znTH56qTojnRhKEnLdhg/iIuVU X-Received: by 2002:a17:906:8145:b0:946:be05:ed7a with SMTP id z5-20020a170906814500b00946be05ed7amr2092185ejw.70.1680620284842; Tue, 04 Apr 2023 07:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680620284; cv=none; d=google.com; s=arc-20160816; b=uQBfyM2DemIIDMO9Sf0TSVgDaulQTA/X0focdJmsdvg7vGrWSwV4NHOxcbn9uQXIKo H8g34uqmOF/56A39gjulLZBmne60URbV0Wvo32b9sLcGS3iGttqQwef+DQ9rIfBwkpGw 0QpWOgpxhkvKvMPhqb0fDRCCe8YKUHBsnVYzMRGopvDzOjA+zFVFpPuFYM8wAu1zB6YY Uyd3kmY508k5bWsPFxrAT0VwSg7SWP4ZuSzhcILawWQdXIgd40i1qN9q3PGRVuDKxqJe 1heSb+aDEnfTK0C4j+Hfigy5K6iwFBMp3nHOnQFcCu1SZYjPTFp6fJLRj0eZaLoEpXRt +1vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s5CBlu3rB6FB4/gHV+J994sqM8eAaiIHabLpvipzBAI=; b=uvFxdZ/a8KjLQELiBX37eK2MAraGUKhBl+onziA69lTbXnwWFA5y6yjsOJxbBuX+Uq iJ0qnbvHHrvFRU1hqe1dez8Uhl+86xVLUrt3lTucY2n4Dp+2zHjdMyxu59r09lkDy0Uh hZThYtgKgoqS/gcxmoev11tIXa0nffvCOMRU/8IS3OnoTpVO90dsFD5QECr/deRm2aiE 7xNvzlbFVwyYqupXoIXxZOoEordIOOIlYG/7rGzzHbwIlYEAC8MkV0m0VmFrw3A2hW25 3zCdNAs2TbOtWMGviYeSjNr0VdBFzjOSAkZaMg+ykLchbl86FRi1Bv7uq9S8XAVJT36H w8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gOUgCrfe; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170906771100b0093d16dd337csi853199ejm.290.2023.04.04.07.57.40; Tue, 04 Apr 2023 07:58:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gOUgCrfe; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234717AbjDDO5D (ORCPT + 99 others); Tue, 4 Apr 2023 10:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234758AbjDDO4f (ORCPT ); Tue, 4 Apr 2023 10:56:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33AEF4EC8 for ; Tue, 4 Apr 2023 07:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680620135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s5CBlu3rB6FB4/gHV+J994sqM8eAaiIHabLpvipzBAI=; b=gOUgCrfeQUjKxwtOafUhZRjKFm8ryWBwbpIMc8Gqnk1cufqOeLFVE7Ftd1ILfxTlPWDYSa tz9/Oth60C9wZWt7pRnUnd2qVt8CDTjfvAVUpgxsYn7T9swqxCeF0tzhGTVriNm2VtOU6n orrXhvOYfXoI//EeuVup1Jy3DpjKM4s= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-tOZ1bAylMGKfA33Mv7ASKA-1; Tue, 04 Apr 2023 10:55:34 -0400 X-MC-Unique: tOZ1bAylMGKfA33Mv7ASKA-1 Received: by mail-qk1-f200.google.com with SMTP id t23-20020a374617000000b0074a4dba4b5aso2201130qka.16 for ; Tue, 04 Apr 2023 07:55:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680620133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s5CBlu3rB6FB4/gHV+J994sqM8eAaiIHabLpvipzBAI=; b=AwGLoUYdgG97NigbBDvOP3cBUTTN988tJPv/w/B7k1La+3DCo9SmAdg8/OGhBH0Qul 0Fug9RMDiLtNKvo1YvNhTVxWlRddSz81DnmKuxSFbqK4P1vCConVpgWXCQYHdc406K/u 4yO2Sl4Y/bCx3Py4WM5bTP8FYexH1j++zUHEwcWnVgfnBpheb9m6XEavWE2pJ+B/yOHq 4jDbjMLkSme9T1bmInngMAZqzG5uyg9avffMULzyLa+y82QKqzD92BxEYr/jJVAtAn0L xOVuXZypg/CPCOLNfVCIF/A9aO/UMIivVBcb0EcnoQdDtArNfcd46EOzrdjcNF21dg1b rH1A== X-Gm-Message-State: AAQBX9f09YxaNHHiCesA18SkNhULFoONrIAJmkaS+WalinnGj+7E23mJ 8EEoJYS6TouS6XpXseV/0mSydu8My6lSw97bjf1bUxmdLlxGw+OOuzTVJ3ET4csdQgqT/otS4qu p8g9gQWbdFRRmHpKHov7o X-Received: by 2002:a05:622a:1116:b0:3d7:7d98:d202 with SMTP id e22-20020a05622a111600b003d77d98d202mr4199908qty.32.1680620133267; Tue, 04 Apr 2023 07:55:33 -0700 (PDT) X-Received: by 2002:a05:622a:1116:b0:3d7:7d98:d202 with SMTP id e22-20020a05622a111600b003d77d98d202mr4199873qty.32.1680620132920; Tue, 04 Apr 2023 07:55:32 -0700 (PDT) Received: from aalbersh.remote.csb ([109.183.6.197]) by smtp.gmail.com with ESMTPSA id j4-20020ac86644000000b003e6387431dcsm3296539qtp.7.2023.04.04.07.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 07:55:32 -0700 (PDT) From: Andrey Albershteyn To: djwong@kernel.org, dchinner@redhat.com, ebiggers@kernel.org, hch@infradead.org, linux-xfs@vger.kernel.org, fsverity@lists.linux.dev Cc: rpeterso@redhat.com, agruenba@redhat.com, xiang@kernel.org, chao@kernel.org, damien.lemoal@opensource.wdc.com, jth@kernel.org, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, Andrey Albershteyn Subject: [PATCH v2 16/23] xfs: add inode on-disk VERITY flag Date: Tue, 4 Apr 2023 16:53:12 +0200 Message-Id: <20230404145319.2057051-17-aalbersh@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230404145319.2057051-1-aalbersh@redhat.com> References: <20230404145319.2057051-1-aalbersh@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Add flag to mark inodes which have fs-verity enabled on them (i.e. descriptor exist and tree is built). Signed-off-by: Andrey Albershteyn --- fs/ioctl.c | 4 ++++ fs/xfs/libxfs/xfs_format.h | 4 +++- fs/xfs/xfs_inode.c | 2 ++ fs/xfs/xfs_iops.c | 2 ++ include/uapi/linux/fs.h | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/ioctl.c b/fs/ioctl.c index 5b2481cd4750..a274b33b2fd0 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -480,6 +480,8 @@ void fileattr_fill_xflags(struct fileattr *fa, u32 xflags) fa->flags |= FS_DAX_FL; if (fa->fsx_xflags & FS_XFLAG_PROJINHERIT) fa->flags |= FS_PROJINHERIT_FL; + if (fa->fsx_xflags & FS_XFLAG_VERITY) + fa->flags |= FS_VERITY_FL; } EXPORT_SYMBOL(fileattr_fill_xflags); @@ -510,6 +512,8 @@ void fileattr_fill_flags(struct fileattr *fa, u32 flags) fa->fsx_xflags |= FS_XFLAG_DAX; if (fa->flags & FS_PROJINHERIT_FL) fa->fsx_xflags |= FS_XFLAG_PROJINHERIT; + if (fa->flags & FS_VERITY_FL) + fa->fsx_xflags |= FS_XFLAG_VERITY; } EXPORT_SYMBOL(fileattr_fill_flags); diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index ef617be2839c..ccb2ae5c2c93 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -1070,16 +1070,18 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) #define XFS_DIFLAG2_COWEXTSIZE_BIT 2 /* copy on write extent size hint */ #define XFS_DIFLAG2_BIGTIME_BIT 3 /* big timestamps */ #define XFS_DIFLAG2_NREXT64_BIT 4 /* large extent counters */ +#define XFS_DIFLAG2_VERITY_BIT 5 /* inode sealed by fsverity */ #define XFS_DIFLAG2_DAX (1 << XFS_DIFLAG2_DAX_BIT) #define XFS_DIFLAG2_REFLINK (1 << XFS_DIFLAG2_REFLINK_BIT) #define XFS_DIFLAG2_COWEXTSIZE (1 << XFS_DIFLAG2_COWEXTSIZE_BIT) #define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) #define XFS_DIFLAG2_NREXT64 (1 << XFS_DIFLAG2_NREXT64_BIT) +#define XFS_DIFLAG2_VERITY (1 << XFS_DIFLAG2_VERITY_BIT) #define XFS_DIFLAG2_ANY \ (XFS_DIFLAG2_DAX | XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE | \ - XFS_DIFLAG2_BIGTIME | XFS_DIFLAG2_NREXT64) + XFS_DIFLAG2_BIGTIME | XFS_DIFLAG2_NREXT64 | XFS_DIFLAG2_VERITY) static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip) { diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 5808abab786c..3b2bf9e7580b 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -634,6 +634,8 @@ xfs_ip2xflags( flags |= FS_XFLAG_DAX; if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) flags |= FS_XFLAG_COWEXTSIZE; + if (ip->i_diflags2 & XFS_DIFLAG2_VERITY) + flags |= FS_XFLAG_VERITY; } if (xfs_inode_has_attr_fork(ip)) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 24718adb3c16..5398be75a76a 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -1232,6 +1232,8 @@ xfs_diflags_to_iflags( flags |= S_NOATIME; if (init && xfs_inode_should_enable_dax(ip)) flags |= S_DAX; + if (xflags & FS_XFLAG_VERITY) + flags |= S_VERITY; /* * S_DAX can only be set during inode initialization and is never set by diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index b7b56871029c..5172a2eb902c 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -140,6 +140,7 @@ struct fsxattr { #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ +#define FS_XFLAG_VERITY 0x00020000 /* fs-verity sealed inode */ #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ /* the read-only stuff doesn't really belong here, but any other place is -- 2.38.4