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 ECEDB3DA5C8; Fri, 24 Jul 2026 23:57:20 +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=1784937442; cv=none; b=OU9tL6XqJr7wKpBY0AN0Kq+rP47na63K2aE1OKbu6xvhEBBwMFeZITUWbr6uzy3jK29+NJdYMybxT+lauT3LlesdSwza765O/tbWME9E9z/o78WlN/uFSI7NEUX9mAhXbn1L2YQ0ICW1bmKrO30i0Z1vf4+6hlkRZzqFYahcGJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784937442; c=relaxed/simple; bh=x4ET0oX5c84OaI7oaJSmZZmMTIK+waQe8b9jZBHKokE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kPJPiexzf+mnMZu/3NWqFOCK9J7AfbnfhSUJVbSKh6P2byvrS6IePH/GqV0C6JUCqiKa/09pl0LnH7AfFQjalzERCt2+2PYdKt9FE/XNwAE7w5WDuG56nqYdIZwpNYFNlyo2nRUxQIE00xWM8XQRGVLJV6UHOmRHnVVQeMbhEDw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bCyKY8CI; 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="bCyKY8CI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51E051F00A3A; Fri, 24 Jul 2026 23:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784937440; bh=C0S2kswV9X4RK00vTenlq33sqHknnXJ8l36Z+cCOrHw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bCyKY8CIpwOcIVw1Calx1/kJVRmpUX/mI5E/uRHL73C3zvnjGYkeZAaOuSttdlCJn vGtG9tlRK+OIfFnqFI30F55IEOvHX0mgkuGh/wwwos2GzDQgwses019ZV3RUUdxsWg vBwn5mCKUZahVt1K7KzLqBzaMxBevZWGgpvu4KdBwGF491YQbaELDtUN9nKwF3acGk np25i8NMPwSxnVvBjkV9iCbyJ1sJbAMxAssmBpAbdD5PKAWXnxHrSi/t4KU6OdGrqD OJIhZlZR+SapJdQ1a3vASLffq20YPOFz7MqlThxqSOvv6cMuxn51B9VnSaY+qaJyjn Fd1j+SiJ9Uf/w== Date: Fri, 24 Jul 2026 16:55:28 -0700 From: Eric Biggers To: Andrey Albershteyn Cc: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, hch@lst.de, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org, djwong@kernel.org Subject: Re: [PATCH v13 06/23] fsverity: don't allow setting DAX file attribute on fsverity files Message-ID: <20260724235528.GD1901@sol> References: <20260721184346.416657-1-aalbersh@kernel.org> <20260721184346.416657-7-aalbersh@kernel.org> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260721184346.416657-7-aalbersh@kernel.org> On Tue, Jul 21, 2026 at 08:40:43PM +0200, Andrey Albershteyn wrote: > When fsverity is enabled on the file, with FS_IOC_ENABLE_VERITY ioctl(), > it checks if file has DAX enabled and fails if that's true. However, the > opposite case is not checked. > > Signed-off-by: Andrey Albershteyn > --- > fs/file_attr.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/file_attr.c b/fs/file_attr.c > index bfb00d256dd5..5424ec4e3949 100644 > --- a/fs/file_attr.c > +++ b/fs/file_attr.c > @@ -246,6 +246,11 @@ static int fileattr_set_prepare(struct inode *inode, > if (fa->fsx_cowextsize == 0) > fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE; > > + /* Can not enable DAX on fsverity file */ > + if ((old_ma->fsx_xflags & FS_XFLAG_VERITY) && > + fa->fsx_xflags & FS_XFLAG_DAX) > + return -EINVAL; > + As mentioned elsewhere, this is actually already checked in ext4, and the commit message should mention this. Also, I notice this function already checks conditions on when the DAX flag can be enabled: /* * It is only valid to set the DAX flag on regular files and * directories on filesystems. */ if ((fa->fsx_xflags & FS_XFLAG_DAX) && !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) return -EINVAL; Could we combine those into something like the following so the DAX enablement conditions are in one place? if (fa->fsx_xflags & FS_XFLAG_DAX) { if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) return -EINVAL; if (old_ma->fsx_xflags & FS_XFLAG_VERITY) return -EINVAL; } - 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 57D5BC531C9 for ; Fri, 24 Jul 2026 23:57:30 +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=+dGEMMmqWjzKFvmwBW+jURN56pR2PQ3ZxdKn4MJraAA=; b=bzOaCpkMZEYFp/DKTRlxIaHZ7F 35RVuBwr3W+93EuYxoaBsvHlvZppJVxKTL+coIe5s+499dS8j6OmGOLPzXCX7RRhaWWdRzMWzryig l+8CAKiJhQWJGCVSW/txR8AxKEwALJMqSX4nTIM+uB75818lyzGo361Mz6JolXoipt6k=; 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 1wnPlj-0004CV-A1; Fri, 24 Jul 2026 23:57:28 +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 1wnPlh-0004CN-Jn for linux-f2fs-devel@lists.sourceforge.net; Fri, 24 Jul 2026 23:57:27 +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=C0S2kswV9X4RK00vTenlq33sqHknnXJ8l36Z+cCOrHw=; b=OGNRWAXXCdRl3seCu04T2U4Pe6 378x6/BqHM1bzVcsNvRbDdBWZ17d+vDvTDKXwz/inbaTXfjkZ2JsEE35ZAm0D5SG9d/HMZRO111Uh pS73SFM0rPaEByJv0qB1j3xIQdYy7zzJSkKrdGkEyh/YBFEEOhfvMQkBBgmMkJ5cXVMk=; 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=C0S2kswV9X4RK00vTenlq33sqHknnXJ8l36Z+cCOrHw=; b=m8EXKd4+EhJIIIg8JlLCiq3wv9 M5Rzj+zd02/BmJp49Yhu3j+C4dA/hDgjlGZBUPw1Bze+rHeSOFDlPoc31o1m/bnve23VR24VM18XN KWMGmLTpzCOUK96i6amL+DTlOVUJI29oBNsWp1JclyROBBNwGnlN9JXzS+th+uAFGXJk=; 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 1wnPle-0007eV-Ms for linux-f2fs-devel@lists.sourceforge.net; Fri, 24 Jul 2026 23:57:27 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id DB178600AD; Fri, 24 Jul 2026 23:57:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51E051F00A3A; Fri, 24 Jul 2026 23:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784937440; bh=C0S2kswV9X4RK00vTenlq33sqHknnXJ8l36Z+cCOrHw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bCyKY8CIpwOcIVw1Calx1/kJVRmpUX/mI5E/uRHL73C3zvnjGYkeZAaOuSttdlCJn vGtG9tlRK+OIfFnqFI30F55IEOvHX0mgkuGh/wwwos2GzDQgwses019ZV3RUUdxsWg vBwn5mCKUZahVt1K7KzLqBzaMxBevZWGgpvu4KdBwGF491YQbaELDtUN9nKwF3acGk np25i8NMPwSxnVvBjkV9iCbyJ1sJbAMxAssmBpAbdD5PKAWXnxHrSi/t4KU6OdGrqD OJIhZlZR+SapJdQ1a3vASLffq20YPOFz7MqlThxqSOvv6cMuxn51B9VnSaY+qaJyjn Fd1j+SiJ9Uf/w== Date: Fri, 24 Jul 2026 16:55:28 -0700 To: Andrey Albershteyn Message-ID: <20260724235528.GD1901@sol> References: <20260721184346.416657-1-aalbersh@kernel.org> <20260721184346.416657-7-aalbersh@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260721184346.416657-7-aalbersh@kernel.org> X-Headers-End: 1wnPle-0007eV-Ms Subject: Re: [f2fs-dev] [PATCH v13 06/23] fsverity: don't allow setting DAX file attribute on fsverity files 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, djwong@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, 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 On Tue, Jul 21, 2026 at 08:40:43PM +0200, Andrey Albershteyn wrote: > When fsverity is enabled on the file, with FS_IOC_ENABLE_VERITY ioctl(), > it checks if file has DAX enabled and fails if that's true. However, the > opposite case is not checked. > > Signed-off-by: Andrey Albershteyn > --- > fs/file_attr.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/file_attr.c b/fs/file_attr.c > index bfb00d256dd5..5424ec4e3949 100644 > --- a/fs/file_attr.c > +++ b/fs/file_attr.c > @@ -246,6 +246,11 @@ static int fileattr_set_prepare(struct inode *inode, > if (fa->fsx_cowextsize == 0) > fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE; > > + /* Can not enable DAX on fsverity file */ > + if ((old_ma->fsx_xflags & FS_XFLAG_VERITY) && > + fa->fsx_xflags & FS_XFLAG_DAX) > + return -EINVAL; > + As mentioned elsewhere, this is actually already checked in ext4, and the commit message should mention this. Also, I notice this function already checks conditions on when the DAX flag can be enabled: /* * It is only valid to set the DAX flag on regular files and * directories on filesystems. */ if ((fa->fsx_xflags & FS_XFLAG_DAX) && !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) return -EINVAL; Could we combine those into something like the following so the DAX enablement conditions are in one place? if (fa->fsx_xflags & FS_XFLAG_DAX) { if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) return -EINVAL; if (old_ma->fsx_xflags & FS_XFLAG_VERITY) return -EINVAL; } - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel