From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796256333; b=Q4bttxQ9epE0ybo6TiQlaC4SPShdF8cdwuXkSKS0gwebjwXwycTSpbRriq1IV/KXedM1 ynE1vMwIlrVrZ2Ru1YUSd0ZPZyBZTCcb6WIMGqMmwyY0fMdnMINtXBB5fx1Y7it1JN2FE Dube0JIgkwMiLIm0n4UsRVzlc13peVoNDvdObEMiM7Mfm/2V+BRMVb8rFyMHBqOwZhNKi iVhvPAAGSVTJZYhECUoj6n98DMImtVvjIr3CydIzxKQgTKFRFGi25DysT5k4LJlK72giq uNxYThmZOTancSbcaXY+aJ1kEc5WtNtRNBrPiz5GaiVvY2acZiFPBAXwlG4cbPQooeg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796256333; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=nkgkz7/PnksWGVMLzKa5Q8gysbZgT6tpXphEZe16YSo=; b=x8HKudekxMu3ZxMNEF+6ITQgIt2DN3fmg1n5ADjv7aZOJxNolDnAeMeGXSKSUsTgbf/Y ajYNHAssN5nl8etM2fFJTzxXH06O/FOavlHmvaFHxlSf4BVOBCLYtclGR2+UG6G23s+R1 Vhvf7Ti0oPF/B56XPk5njpb29KoJXCg1Eq0/fmhNb3aF+Vsotaa02AxOWw6sskZLl+h9f xil7lXfOPVlfXaN6iXBFMR8Q57UOtTGwWNPY+mEssucuiH5DukRkvjfh0kcJQf7RsjRfh arOnxmVY4/Rcbasja95wo4PCg8Cl1mSbl/LcZTMXQzrw6WX05GnNhTgWWAeVAbqiVJA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Yq35Byu4; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88CBF606A680; Thu, 3 Dec 2026 00:05:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Yq35Byu4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 645841F00898; Thu, 3 Dec 2026 00:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796256332; bh=nkgkz7/PnksWGVMLzKa5Q8gysbZgT6tpXphEZe16YSo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Yq35Byu4q8jjmm18+UKgSqXxUAjCOmSLYKGuwEcHbZ0LWogqBxEfgVi+dQjpRJqUB Ymo0mNze3y7VLUHD4zcEmaOjlbNTyghhZgHWuXsKdKQPORMr3UiBQDP381/eR2afyI 6yo0hHBW4rim3fMppMhIzwhPoRARZkl2NTjKL2J0/b1ZrHHp67opi2eMA9XOMiOeZz YpRQg3U+r3/IJyQKMn2iwVGDtU9dD4Skowf4wwEW6fhltRFwHECvQhMdmwXFkH09v3 W8q1jiYRgk8vOfWB3OJw56d0+u4He/1QOUxrVe95KHa6Tel3GmYvALU6DkNvp+U6NJ ffm8+9PRgv40g== Date: Thu, 3 Dec 2026 00:05:30 +0000 From: Eric Biggers To: Andrey Albershteyn Cc: fsdevel , linux-ext4 , linux-btrfs , linux-f2fs , Christoph Hellwig , Carlos Maiolino , fsverity , linux-xfs , Christian Brauner , david@fromorbit.com Subject: Re: [PATCH v20 04/23] fs,fsverity: reject S_APPEND on fsverity inodes Message-ID: <20261203000530.GE338490@google.com> References: <20261202165653.767961-1-aalbersh@kernel.org> <20261202165653.767961-5-aalbersh@kernel.org> X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261202165653.767961-5-aalbersh@kernel.org> On Wed, Dec 02, 2026 at 05:56:34PM +0100, Andrey Albershteyn wrote: > fs-verity rejects enabling fsverity on append only files. However, there > are two cases when FS_IOC_SETFLAGS can turn inode append only. > > The first one is right before the lock is taken in the enable_verity(), > making original check useless. > > The second one is after lock in enable_verity() is unlocked, therefore, > when merkle tree is being build and after fs-verity inode is sealed. > This one is not critical, it just sets incompatible flags on inode but > append-only inode will not get any writes anyway. > > Fix it by checking S_APPEND again under the lock, serializing this with > vfs_fileattr_set() and reject S_APPEND on fsverity inodes. > > Fixes: 3fda4c617e84 ("fs-verity: implement FS_IOC_ENABLE_VERITY ioctl") > Signed-off-by: Andrey Albershteyn Does this patch solve an actual problem? It is not mentioned. Setting the append-only flag on an inode has never caused writes to already-open fds to be restricted to the end of the file. Similarly, append-only files can be truncated, unlinked, hardlinked, or have holes punched in them if the syscalls were already in progress -- even though those are operations that the append-only flag normally prevents. The lockless check of IS_APPEND() in fsverity_ioctl_enable() seems consistent with that. It's considered an operation that's blocked by append-only, but it's accepted that it could occur anyway if it happens to be ongoing at the same time the append-only flag is set. I assume LLMs don't like the existence of the race, and this is why you added this patch. However, I don't think it makes much sense to change here unless we commit to also change all the instances in the VFS (which are for much more common file operations than enabling verity). Also note that if someone does have the append-only flag set on an fsverity file already (which was possible before, by setting the flag afterwards), then this commit breaks the usual FS_IOC_GETFLAGS + FS_IOC_SETFLAGS sequence for changing unrelated flags on such files. - Eric