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=1796232493; b=NwGWxMvUEFhzHEqeuU9UxQ4RWDpMo5fIIFLjVT9IURWgyFGhn2k8ETxsAihdoc8aBNT0 NdLmHJJTQVw9kzn1IMMO1Jhv/tgF7bTLjmwjtCuDCGf/3dzAq1yWBTRRDrxmnP1UTA1eb D4RmebTABdjV1do7xDKXg3KnEUYmhr0MsNNHz/XgAj1fq3GEpjfTK/ZcPeiQ3U33YVobq FJobfopsMFGKV6vVhUukA8to/c9sstBgpY8HLQbD+w45nmFtygL3AHlTAlkzaqOOkvoGW c6V4f+E5GGaSfphgPeJO+/fufEHY4losojQ/nykbWSIcWyxsJARTKTrDc8UQuoFDUMQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796232493; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=oVBUS2S3KtI8N7R0yBa/qJvkV7FFvp2UDdSX5X8L3MA=; b=fqqvEuFrdrcao6gOdx14GgWOgfR97QjcE5R/1d0XsTVtYJjUAD4DOfOGiPhA6KKFOCxo LhpBi0khstDTX8/SJST18qLSjEeJEB1jkQwV53dVYBXTYOMbc1TuDyffloBZvdqlI+ddK KF8A2Kc3KC4cWJfn8hsOVPRG15Eiqr79dptUgDxoCvuU6Ihhw2N8NanerzH0MI0LpUhIK MXdV9Sdx8TOMhX2jlkdtnoQ39TQAFwn4U9lKf6Fxq73Id64AQg4ijuYccl3ukSxtG/Xot GPg6E/sUS34PP7WyDBiGB+Kqln/90wpbzXBkSyiBLusjr05o7YTzvZFK19heiK/TkPw== 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=aQ6RTD67; 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 AFF84606A322; Wed, 2 Dec 2026 17:28:13 +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=aQ6RTD67 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5E741F000C1; Wed, 2 Dec 2026 17:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796232493; bh=oVBUS2S3KtI8N7R0yBa/qJvkV7FFvp2UDdSX5X8L3MA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=aQ6RTD67AiHSNYVXwrUlEV8+iUIzxluYWiOCGRxR3D0njyX4U3el/lwlituIlzqZ6 4dDijJgAMWIQpICwQxEmfDYkfkfc49FnGbMQWWYbaGZp+s/0fHwnY1xGLIT150bSQI 1+FH1O1n4oLZHUM8TsojwcvEdje9kDWhDjgD2R9NJL8zPF6VzNnq5phyPPQhYNI449 BYYxEBWdRQFI02roKboD9Tn5VOCDLtXlECDgrNeh+yeqXlh+K9j2OTX+vEb14tCT6z LlgCQF96mxRs9kmutdpn4+aK64uNuT+6pFvFUPoyM6wzK0j9b2DXiKlMYVEVkmH+vS cZdezhAQvG7zg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v20 13/23] xfs: handle fsverity I/O in write/read path Reply-To: sashiko-reviews@lists.linux.dev To: "Andrey Albershteyn" , linux-ext4 , "Eric Biggers" , "Christoph Hellwig" , "Carlos Maiolino" , fsverity Cc: "Christian Brauner" , david@fromorbit.com, dsterba@suse.cz, tytso@mit.edu In-Reply-To: <20261202165653.767961-14-aalbersh@kernel.org> References: <20261202165653.767961-1-aalbersh@kernel.org> <20261202165653.767961-14-aalbersh@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 17:28:11 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] xfs: signed loff_t overflow in xfs_fsverity_metadata_offset() -- commit 4a03a70110386ebb0ec2056edfff5268071a3316 Author: Andrey Albershteyn xfs: handle fsverity I/O in write/read path This commit passes the mapping offset to xfs_bmbt_to_iomap() and sets IOMAP_F_FSVERITY when the offset falls within the inode's fs-verity metadata region. > diff --git a/fs/xfs/libxfs/xfs_verity.c b/fs/xfs/libxfs/xfs_verity.c > new file mode 100644 > index 0000000000000..c1731b89a5a12 > --- /dev/null > +++ b/fs/xfs/libxfs/xfs_verity.c > @@ -0,0 +1,20 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2026 Red Hat, Inc. > + */ > +#include "xfs_platform.h" > +#include "xfs_fs.h" > +#include "xfs_shared.h" > +#include "xfs_format.h" > +#include "xfs_log_format.h" > +#include "xfs_trans_resv.h" > +#include "xfs_mount.h" > +#include "xfs_inode.h" > +#include "xfs_verity.h" > + > +loff_t > +xfs_fsverity_metadata_offset( > + const struct xfs_inode *ip) > +{ > + return round_up(i_size_read(VFS_IC(ip)), XFS_FSVERITY_START_ALIGN); > +} > diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c > index 50eae7ff61453..5117704530f69 100644 > --- a/fs/xfs/xfs_iomap.c > +++ b/fs/xfs/xfs_iomap.c [ ... ] > @@ -54,6 +56,15 @@ xfs_alert_fsblock_zero( > return -EFSCORRUPTED; > } > =20 > +static bool > +xfs_iomap_is_fsverity_metadata( > + struct xfs_inode *ip, > + loff_t offset) > +{ > + return offset >=3D xfs_fsverity_metadata_offset(ip) && > + (fsverity_is_building(VFS_I(ip)) || fsverity_active(VFS_I(ip))); > +} [Severity: Medium] Can round_up() in xfs_fsverity_metadata_offset() overflow a signed 64-bit loff_t and wrap to LLONG_MIN when i_size > LLONG_MAX - (XFS_FSVERITY_START_ALIGN - 1)? Because xfs_iomap_is_fsverity_metadata() calls xfs_fsverity_metadata_offset() before checking fsverity_is_building() or fsverity_active(), every non-xattr xfs_bmbt_to_iomap() call executes this calculation even on non-verity files (which can be truncated up to s_maxbytes =3D=3D LLONG_MAX) and when CONFIG_FS_VERITY is disabled. In addition, on a crafted or corrupted on-disk image where an XFS_DIFLAG2_VERITY inode has di_size > 0x7fffffffffff0000, the wrap to LLONG_MIN causes xfs_iomap_is_fsverity_metadata() to return true and set IOMAP_F_FSVERITY for every non-negative file offset. Checking fsverity_is_building() || fsverity_active() before calling xfs_fsverity_metadata_offset(), and validating di_size against the maximum fs-verity file size for XFS_DIFLAG2_VERITY inodes in xfs_dinode_verify(), would avoid both issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202165653.7679= 61-1-aalbersh@kernel.org?part=3D13