From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 09BD046EC78; Tue, 21 Jul 2026 18:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784659442; cv=none; b=ozyffC9OV4SC4AqvyLM8SFEBP0K5Mfor+M4g7ton76PbKCr2RUGrgdx7M0cnuWB5SjLSn08ayh26K4p1u1kwPNScjuPXmeWTycLw6YLP8r0oMtV37abJjeCdeguO0QCrpILab3us1hKyQ2DPWThR4EWvCiq+laA9IsOXEhW1mbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784659442; c=relaxed/simple; bh=koL5JEzCiRkG/G3J5KeYw/fhC7PQNkfGJUXQmn9MaK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tYXlsCVhSAvsCVHou3yol27f1jMxcRJwGHBFFDZc2yXRaYeq8VR0UmXbxWQ4vd9rWQC5tpBqTLVh4HXE5ffjVtb6U7H4Sqzm94KfDpzdLPZbgM4sb6cQfJ2/oB6I5tyt1EnQPrA2Eda8B9sP0GMCtJriYfRmIgOGMgzmfoESFqw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d9PD9Gi5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d9PD9Gi5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41B6C1F00A3A; Tue, 21 Jul 2026 18:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784659440; bh=IA66KD2Om75bu0eBgUIzf65HS6s2gELQcRJU2+ySoSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=d9PD9Gi5vMT6p1hhlIj/h/itwE7/mT8ZOVX0NLfvqabqzhefeNTQgxihcd+drWpPw g3ykeZ9fmuQXv3HzHRpCF31G2zyQEmbrzr+5HCL1jnXP0eyz4ynKhjt3dNY9ZmGwy9 JjzMlvFU3Cfut2m5oyd/UR0eTH6+oNJz1VQhd511VRAySM2aI9SH6aeSKu+dTqLWy6 z2p+JauZKZdv6XTW8UZJv5CEPhWvp0QXu1WdgvmACiEhaPcMST8Zb7GHK1r6Xvw448 K4iMbCwypr55YzjyOqYNvyMsbXcOrM9ZxVKnsOtRP5FkQSfVGKviaLLmEWbhw2ktqA ZI87u6hb490xA== From: Andrey Albershteyn To: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org Cc: Andrey Albershteyn , hch@lst.de, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org, djwong@kernel.org Subject: [PATCH v13 02/23] fsverity: expose ensure_fsverity_info() Date: Tue, 21 Jul 2026 20:40:39 +0200 Message-ID: <20260721184346.416657-3-aalbersh@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260721184346.416657-1-aalbersh@kernel.org> References: <20260721184346.416657-1-aalbersh@kernel.org> Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This function will be used by XFS's scrub to force fsverity activation, therefore, to read fsverity context. Reviewed-by: Darrick J. Wong Acked-by: Eric Biggers Signed-off-by: Andrey Albershteyn Reviewed-by: Christoph Hellwig --- fs/verity/open.c | 22 ++++++++++++++++++++-- include/linux/fsverity.h | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/fs/verity/open.c b/fs/verity/open.c index d0c56a7faa3b..875e8850ccba 100644 --- a/fs/verity/open.c +++ b/fs/verity/open.c @@ -347,7 +347,24 @@ int fsverity_get_descriptor(struct inode *inode, return 0; } -static int ensure_verity_info(struct inode *inode) +/** + * fsverity_ensure_verity_info() - cache verity info if it's not already cached + * @inode: the inode for which verity info should be cached + * + * Ensure this inode has verity info attached to it, it's assumed the inode + * already has fsverity enabled. Read fsverity descriptor and creates verity + * based on that. + * + * This needs to be called at least once before any of the inode's data + * can be verified (and thus read at all) or the inode's fsverity digest + * retrieved. fsverity_file_open() calls this already, which handles + * normal file accesses. If a filesystem does any internal (i.e. not + * associated with a file descriptor) reads of the file's data or + * fsverity digest, it must call this explicitly before doing so. + * + * Return: 0 on success, -errno on failure + */ +int fsverity_ensure_verity_info(struct inode *inode) { struct fsverity_info *vi = fsverity_get_info(inode), *found; struct fsverity_descriptor *desc; @@ -383,12 +400,13 @@ static int ensure_verity_info(struct inode *inode) kfree(desc); return err; } +EXPORT_SYMBOL_GPL(fsverity_ensure_verity_info); int __fsverity_file_open(struct inode *inode, struct file *filp) { if (filp->f_mode & FMODE_WRITE) return -EPERM; - return ensure_verity_info(inode); + return fsverity_ensure_verity_info(inode); } EXPORT_SYMBOL_GPL(__fsverity_file_open); diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h index 6c467ded9751..3c3250f6f272 100644 --- a/include/linux/fsverity.h +++ b/include/linux/fsverity.h @@ -317,6 +317,8 @@ static inline int fsverity_file_open(struct inode *inode, struct file *filp) return 0; } +int fsverity_ensure_verity_info(struct inode *inode); + void fsverity_cleanup_inode(struct inode *inode); struct page *generic_read_merkle_tree_page(struct inode *inode, pgoff_t index); -- 2.54.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB73CC4452D for ; Tue, 21 Jul 2026 18:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:References:In-Reply-To: Message-ID:Date:To:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QKYx6cIL2ukJX3WZMeNAc7O5JPJgqorB0+m1nb4D9B4=; b=ZLW4xBYdM1dwsrLtYGU5EqJieJ 46krLrG3rKee++W+YbqA7jPrPFsw99tOeiWuEPgzeCGOls5wET0xayT1ukvWtRnRj8skv+e1R7BZ+ BaRem8KKTAGfxqOLVuC7FfoBk9g/EczDO9+9XIQFQWS9y+KTLdkEXjg4y9hv2FkfR6og=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wmFRx-0003IZ-Ss; Tue, 21 Jul 2026 18:44:15 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wmFRv-0003IQ-U2 for linux-f2fs-devel@lists.sourceforge.net; Tue, 21 Jul 2026 18:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IA66KD2Om75bu0eBgUIzf65HS6s2gELQcRJU2+ySoSU=; b=LpLfA93LSY3q1IgmmcOuQE9r8C 3umnja8jdG7bkJplafSnr2zEKkcVVnfGEw+2kJh1Hp3YA/hnSf81vTErEu/0a4PPJ5ZiTP/331DNL BZ3B49oOCCqK7UlqzGWPVQmCiW3DVbbPNcONppFdlmdJIQcpC5VY9rgRDCBfmgDp9SbA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=IA66KD2Om75bu0eBgUIzf65HS6s2gELQcRJU2+ySoSU=; b=UNtPdbPHA2x/y5dZgvtQAHrnJT V0g6xA0U1SO78khV9JyLdh73BLvm2ex/H0QWMhTSqhNaADAX876Lr9fk8qqTrESGpzoM2SKFVgCrp r+Rkx/oCXst2wKFhetcXWA2ltgD7hYECKwKmSOG0ZUMbDU4QmnVWBnGC/jeOvWD0HFBM=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wmFRr-00030H-Om for linux-f2fs-devel@lists.sourceforge.net; Tue, 21 Jul 2026 18:44:13 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 2D45860103; Tue, 21 Jul 2026 18:44:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41B6C1F00A3A; Tue, 21 Jul 2026 18:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784659440; bh=IA66KD2Om75bu0eBgUIzf65HS6s2gELQcRJU2+ySoSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=d9PD9Gi5vMT6p1hhlIj/h/itwE7/mT8ZOVX0NLfvqabqzhefeNTQgxihcd+drWpPw g3ykeZ9fmuQXv3HzHRpCF31G2zyQEmbrzr+5HCL1jnXP0eyz4ynKhjt3dNY9ZmGwy9 JjzMlvFU3Cfut2m5oyd/UR0eTH6+oNJz1VQhd511VRAySM2aI9SH6aeSKu+dTqLWy6 z2p+JauZKZdv6XTW8UZJv5CEPhWvp0QXu1WdgvmACiEhaPcMST8Zb7GHK1r6Xvw448 K4iMbCwypr55YzjyOqYNvyMsbXcOrM9ZxVKnsOtRP5FkQSfVGKviaLLmEWbhw2ktqA ZI87u6hb490xA== To: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org Date: Tue, 21 Jul 2026 20:40:39 +0200 Message-ID: <20260721184346.416657-3-aalbersh@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260721184346.416657-1-aalbersh@kernel.org> References: <20260721184346.416657-1-aalbersh@kernel.org> MIME-Version: 1.0 X-Headers-End: 1wmFRr-00030H-Om Subject: [f2fs-dev] [PATCH v13 02/23] fsverity: expose ensure_fsverity_info() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrey Albershteyn via Linux-f2fs-devel Reply-To: Andrey Albershteyn Cc: Andrey Albershteyn , djwong@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, hch@lst.de, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This function will be used by XFS's scrub to force fsverity activation, therefore, to read fsverity context. Reviewed-by: Darrick J. Wong Acked-by: Eric Biggers Signed-off-by: Andrey Albershteyn Reviewed-by: Christoph Hellwig --- fs/verity/open.c | 22 ++++++++++++++++++++-- include/linux/fsverity.h | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/fs/verity/open.c b/fs/verity/open.c index d0c56a7faa3b..875e8850ccba 100644 --- a/fs/verity/open.c +++ b/fs/verity/open.c @@ -347,7 +347,24 @@ int fsverity_get_descriptor(struct inode *inode, return 0; } -static int ensure_verity_info(struct inode *inode) +/** + * fsverity_ensure_verity_info() - cache verity info if it's not already cached + * @inode: the inode for which verity info should be cached + * + * Ensure this inode has verity info attached to it, it's assumed the inode + * already has fsverity enabled. Read fsverity descriptor and creates verity + * based on that. + * + * This needs to be called at least once before any of the inode's data + * can be verified (and thus read at all) or the inode's fsverity digest + * retrieved. fsverity_file_open() calls this already, which handles + * normal file accesses. If a filesystem does any internal (i.e. not + * associated with a file descriptor) reads of the file's data or + * fsverity digest, it must call this explicitly before doing so. + * + * Return: 0 on success, -errno on failure + */ +int fsverity_ensure_verity_info(struct inode *inode) { struct fsverity_info *vi = fsverity_get_info(inode), *found; struct fsverity_descriptor *desc; @@ -383,12 +400,13 @@ static int ensure_verity_info(struct inode *inode) kfree(desc); return err; } +EXPORT_SYMBOL_GPL(fsverity_ensure_verity_info); int __fsverity_file_open(struct inode *inode, struct file *filp) { if (filp->f_mode & FMODE_WRITE) return -EPERM; - return ensure_verity_info(inode); + return fsverity_ensure_verity_info(inode); } EXPORT_SYMBOL_GPL(__fsverity_file_open); diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h index 6c467ded9751..3c3250f6f272 100644 --- a/include/linux/fsverity.h +++ b/include/linux/fsverity.h @@ -317,6 +317,8 @@ static inline int fsverity_file_open(struct inode *inode, struct file *filp) return 0; } +int fsverity_ensure_verity_info(struct inode *inode); + void fsverity_cleanup_inode(struct inode *inode); struct page *generic_read_merkle_tree_page(struct inode *inode, pgoff_t index); -- 2.54.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel