From mboxrd@z Thu Jan 1 00:00:00 1970 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 9C5112C027C; Mon, 26 Jan 2026 20:12:08 +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=1769458328; cv=none; b=i79V/FBxa9FJMijdix4gURmZrbDg+CP/HytoWTvIx07No5+N+pJn02AsUQQ31/teX1NTP+zfZRYG9bcpLK9XMm5u4Z2tT4GDPv8r0AkDSB5A+A4WxGAa10AJg472UQ06DD4YPNpinVvdaeVkftG7U5zhJ4J+lhiydV7fBsTpb+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769458328; c=relaxed/simple; bh=NBe+OxYRigsrCScWNRGhoFuPEsSz3lykHJTIWDbyMDI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jUeFvyPqwIj7MkFwY4LHp/BYsTYlewRh72QM+1z2V4uHM1Hh/eRV0lSekiaMGcU00WfOn2hsVeYwLg2HI+r48EGtTbGj2ctAlZDAB9SZE70lyFRQ9cDfOM6jRjNndJQweGo4U8KZWnFluyezWNuFdkteG+XDfHNcGZgqP8x57m8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B3K3AwRd; 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="B3K3AwRd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C26AEC116C6; Mon, 26 Jan 2026 20:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769458328; bh=NBe+OxYRigsrCScWNRGhoFuPEsSz3lykHJTIWDbyMDI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B3K3AwRdtBqGRu/L0NVC2m/GP0oeFUwZGfM5GvznVm9SC4gLQ0Q/wUEhnJgCtVJ6/ 3hBgOYdjlX4u9PUZ0AVnNlNqsADYsiji5c7ZCYbDF3dPITcbpj0MWR24shiGQ+aZyN qhBUxH2vAzOy0Q+hW8/87TrJC5oOxviszzzyQi+o7HiwPKy0ODSW/eeG+xVqNQNFPG aCd3Tr+fuP0vTljmBoLEVDvqhaqRvXutNBbYDiGg3XmuUxeCLfYatg3u21MkYa6tET 4+2gllNik8k0IpeNxNVqiGa88nvSll2D2FKnPiS0Mz94gEdfhKUxrVNYxjgAXP6E/N Wg+2yKtJ8gj+A== Date: Mon, 26 Jan 2026 12:12:06 -0800 From: Eric Biggers To: Christoph Hellwig Cc: Matthew Wilcox , Al Viro , Christian Brauner , Jan Kara , David Sterba , Theodore Ts'o , Jaegeuk Kim , Chao Yu , Andrey Albershteyn , linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, fsverity@lists.linux.dev Subject: Re: [PATCH 11/11] fsverity: use a hashtable to find the fsverity_info Message-ID: <20260126201206.GA30838@quark> References: <20260122082214.452153-1-hch@lst.de> <20260122082214.452153-12-hch@lst.de> <20260125013104.GA2255@sol> <20260126044432.GE30803@lst.de> Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260126044432.GE30803@lst.de> On Mon, Jan 26, 2026 at 05:44:32AM +0100, Christoph Hellwig wrote: > On Sun, Jan 25, 2026 at 09:48:22PM +0000, Matthew Wilcox wrote: > > Is there a reason not to do as DAX did: > > > +#ifdef CONFIG_FS_VERITY > > #define S_VERITY (1 << 16) /* Verity file (using fs/verity/) */ > > +#else > > +#define S_VERITY 0 /* Make all the verity checks disappear */ > > +#endif > > #define S_KERNEL_FILE (1 << 17) /* File is in use by the kernel (eg. fs/cachefiles) */ > > #define S_ANON_INODE (1 << 19) /* Inode is an anonymous inode */ > > > > > > and then we can drop the CONFIG_FS_VERITY check here and in (at leaast) > > three other places > > I looked into this, but wasn't entirely sure about all callers. Also > in at least some places we might need the barrier in fsverity_active, > so my plan was to see how many of the checks should simply be converted > to fsverity_active in a follow on and how much is left after that first. When CONFIG_FS_VERITY=n, there can still be inodes that have fsverity enabled, since they might have already been present on the filesystem. The S_VERITY flag and the corresponding IS_VERITY() macro are being used to identify such inodes and handle them appropriately. Consider fsverity_file_open() for example: static inline int fsverity_file_open(struct inode *inode, struct file *filp) { if (IS_VERITY(inode)) return __fsverity_file_open(inode, filp); return 0; } When CONFIG_FS_VERITY=n, __fsverity_file_open() resolves to the stub: static inline int __fsverity_file_open(struct inode *inode, struct file *filp) { return -EOPNOTSUPP; } So the result is that on a kernel that doesn't have fsverity support enabled, trying to open an fsverity file fails with EOPNOTSUPP. But this relies on IS_VERITY() still working correctly. Similar code that relies on IS_VERITY() working correctly exists in other places as well, for example in the implementation of statx(). So IS_VERITY() can't be changed to always return false when CONFIG_FS_VERITY=n, unless we identified all the callers like these and updated them to check the underlying filesystem-specific flag instead. - Eric 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 97BBCD19518 for ; Mon, 26 Jan 2026 20:12:27 +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:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sv5oO97MQ+N1jJMJ7TO7UnmS2iXacRcQM/D4kP5Ruj4=; b=dO5TCFd4pgpy2HiZPTsCT9qAur o7S50dB8jqM26zmfdQA0ko92DBf1vd2XNwW5KjwNgEBY81ciSCHV7PFxFEPCdzZnGE0NjIhHJdGFg QlfmMdUNGrF+NC5/n5bDJIfR/RAwLjmsBnc8GwTr7x6X1nUnwkNgbox4JhBt5q5lbyLk=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vkSwf-0006Up-AW; Mon, 26 Jan 2026 20:12:21 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vkSwe-0006Uh-4n for linux-f2fs-devel@lists.sourceforge.net; Mon, 26 Jan 2026 20:12:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: 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=K3a2LuJyM8A34y7ZMBWL2sHWQ4VubhNlxvSQAErPJ1o=; b=mNejbOhroA42Corp2+7PwHedhI FKSBhXe/wi/CwD0QP2t4F4Hm2RH2MEVCZfzBhsYEnM5jdMcOcI/G/4svIyK8RuzDeCECW4flU0ca3 gZpqXkMVEq1kASIFX7sdkjmhvGMA0ydPdW4SWwRPKpj3GMhWPanEG3xY6KMzB3Ge5puw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding: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=K3a2LuJyM8A34y7ZMBWL2sHWQ4VubhNlxvSQAErPJ1o=; b=UdfSajWDLhPU1DYlsNyScc/8ua 5gzfI/Ln2Uf/RFi3AwO/nIK58otidrrxEPdOT93/3gIwwdLplmXD2tswTctFxabHJLJu+YSALQ6TU yxfTUxtAvF4uKwBWSGr+phIzXi77tAdfoOZ29tGekH+GpbozrNDAgm/IOyjUCJanifM0=; 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 1vkSwd-0008Nv-Js for linux-f2fs-devel@lists.sourceforge.net; Mon, 26 Jan 2026 20:12:20 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id C791D60121; Mon, 26 Jan 2026 20:12:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C26AEC116C6; Mon, 26 Jan 2026 20:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769458328; bh=NBe+OxYRigsrCScWNRGhoFuPEsSz3lykHJTIWDbyMDI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B3K3AwRdtBqGRu/L0NVC2m/GP0oeFUwZGfM5GvznVm9SC4gLQ0Q/wUEhnJgCtVJ6/ 3hBgOYdjlX4u9PUZ0AVnNlNqsADYsiji5c7ZCYbDF3dPITcbpj0MWR24shiGQ+aZyN qhBUxH2vAzOy0Q+hW8/87TrJC5oOxviszzzyQi+o7HiwPKy0ODSW/eeG+xVqNQNFPG aCd3Tr+fuP0vTljmBoLEVDvqhaqRvXutNBbYDiGg3XmuUxeCLfYatg3u21MkYa6tET 4+2gllNik8k0IpeNxNVqiGa88nvSll2D2FKnPiS0Mz94gEdfhKUxrVNYxjgAXP6E/N Wg+2yKtJ8gj+A== Date: Mon, 26 Jan 2026 12:12:06 -0800 To: Christoph Hellwig Message-ID: <20260126201206.GA30838@quark> References: <20260122082214.452153-1-hch@lst.de> <20260122082214.452153-12-hch@lst.de> <20260125013104.GA2255@sol> <20260126044432.GE30803@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260126044432.GE30803@lst.de> X-Headers-End: 1vkSwd-0008Nv-Js Subject: Re: [f2fs-dev] [PATCH 11/11] fsverity: use a hashtable to find the 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: Eric Biggers via Linux-f2fs-devel Reply-To: Eric Biggers Cc: fsverity@lists.linux.dev, Christian Brauner , Theodore Ts'o , Andrey Albershteyn , Matthew Wilcox , linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, Al Viro , Jaegeuk Kim , David Sterba , Jan Kara , linux-ext4@vger.kernel.org, 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 On Mon, Jan 26, 2026 at 05:44:32AM +0100, Christoph Hellwig wrote: > On Sun, Jan 25, 2026 at 09:48:22PM +0000, Matthew Wilcox wrote: > > Is there a reason not to do as DAX did: > > > +#ifdef CONFIG_FS_VERITY > > #define S_VERITY (1 << 16) /* Verity file (using fs/verity/) */ > > +#else > > +#define S_VERITY 0 /* Make all the verity checks disappear */ > > +#endif > > #define S_KERNEL_FILE (1 << 17) /* File is in use by the kernel (eg. fs/cachefiles) */ > > #define S_ANON_INODE (1 << 19) /* Inode is an anonymous inode */ > > > > > > and then we can drop the CONFIG_FS_VERITY check here and in (at leaast) > > three other places > > I looked into this, but wasn't entirely sure about all callers. Also > in at least some places we might need the barrier in fsverity_active, > so my plan was to see how many of the checks should simply be converted > to fsverity_active in a follow on and how much is left after that first. When CONFIG_FS_VERITY=n, there can still be inodes that have fsverity enabled, since they might have already been present on the filesystem. The S_VERITY flag and the corresponding IS_VERITY() macro are being used to identify such inodes and handle them appropriately. Consider fsverity_file_open() for example: static inline int fsverity_file_open(struct inode *inode, struct file *filp) { if (IS_VERITY(inode)) return __fsverity_file_open(inode, filp); return 0; } When CONFIG_FS_VERITY=n, __fsverity_file_open() resolves to the stub: static inline int __fsverity_file_open(struct inode *inode, struct file *filp) { return -EOPNOTSUPP; } So the result is that on a kernel that doesn't have fsverity support enabled, trying to open an fsverity file fails with EOPNOTSUPP. But this relies on IS_VERITY() still working correctly. Similar code that relies on IS_VERITY() working correctly exists in other places as well, for example in the implementation of statx(). So IS_VERITY() can't be changed to always return false when CONFIG_FS_VERITY=n, unless we identified all the callers like these and updated them to check the underlying filesystem-specific flag instead. - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel