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 C8A981AF0CA; Thu, 30 Jan 2025 08:41:37 +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=1738226497; cv=none; b=ugEVf+sCCuCpR3ktTDzONRP9jmNYkGiLMoiPQ6HIrfRpg59z7dYGcO9nFdgj5V1dln9gNlK0jaLqd4RylpbvwX83Aw61TJ/wjuDRIZ6PMlnnBfsPaxlSey2o+YCo/XtGYUwBnyrDRQpVqXWRYUpgCRAexfjelfrjGcX2H0rHGdk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738226497; c=relaxed/simple; bh=aW+l/fCpsdHkO+bxxTvn+m0oZkh7vHrp4l//e0e5dNE=; h=Subject:To:Cc:From:Date:In-Reply-To:Message-ID:MIME-Version: Content-Type; b=SSwvoUu2rPqce9LHsxYrakf9mBs6poA2yrngyR1ohDr8WTPQvuj6a4k6Hgi4udqO/4SHYrZlPxBZy3lntc0uFmkEtfjWNjoCQ5QdkQKHDsYo8jJ/XDLE53tyAeBisQ6elbecFksgWsoJGKxpSqD8i6iGAdz/cOqvOzJAQQeswJo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=O6xuROhu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="O6xuROhu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E5E0C4CED2; Thu, 30 Jan 2025 08:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1738226497; bh=aW+l/fCpsdHkO+bxxTvn+m0oZkh7vHrp4l//e0e5dNE=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=O6xuROhuJ+LiT6M3ArKpzN2wpo34+BqomSp0ppSEkDlmSJc7PUDlYqawx5SoFInu0 ndVN5sR1Tj8XaJyWMkg5xv/9K1KH0Nhbx8jxLS6T/vVJfIKsBQvAugIDnVgDDpZY+7 thAUkFj2nsZBsF6xM/dVD0rQ8JSXx3mWlJ2Zic5w= Subject: Patch "xfs: inode recovery does not validate the recovered inode" has been added to the 6.1-stable tree To: amir73il@gmail.com,catherine.hoang@oracle.com,chandan.babu@oracle.com,chandanbabu@kernel.org,dchinner@redhat.com,djwong@kernel.org,gregkh@linuxfoundation.org,leah.rumancik@gmail.com,xfs-stable@lists.linux.dev Cc: From: Date: Thu, 30 Jan 2025 09:41:00 +0100 In-Reply-To: <20250129184717.80816-16-leah.rumancik@gmail.com> Message-ID: <2025013000-jaybird-net-1e94@gregkh> Precedence: bulk X-Mailing-List: xfs-stable@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore This is a note to let you know that I've just added the patch titled xfs: inode recovery does not validate the recovered inode to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-inode-recovery-does-not-validate-the-recovered-inode.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From stable+bounces-111226-greg=kroah.com@vger.kernel.org Wed Jan 29 19:47:59 2025 From: Leah Rumancik Date: Wed, 29 Jan 2025 10:47:13 -0800 Subject: xfs: inode recovery does not validate the recovered inode To: stable@vger.kernel.org Cc: xfs-stable@lists.linux.dev, amir73il@gmail.com, chandan.babu@oracle.com, catherine.hoang@oracle.com, Dave Chinner , "Darrick J. Wong" , Chandan Babu R , Leah Rumancik Message-ID: <20250129184717.80816-16-leah.rumancik@gmail.com> From: Dave Chinner [ Upstream commit 038ca189c0d2c1570b4d922f25b524007c85cf94 ] Discovered when trying to track down a weird recovery corruption issue that wasn't detected at recovery time. The specific corruption was a zero extent count field when big extent counts are in use, and it turns out the dinode verifier doesn't detect that specific corruption case, either. So fix it too. Signed-off-by: Dave Chinner Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Leah Rumancik Signed-off-by: Greg Kroah-Hartman --- fs/xfs/libxfs/xfs_inode_buf.c | 3 +++ fs/xfs/xfs_inode_item_recover.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -507,6 +507,9 @@ xfs_dinode_verify( if (mode && nextents + naextents > nblocks) return __this_address; + if (nextents + naextents == 0 && nblocks != 0) + return __this_address; + if (S_ISDIR(mode) && nextents > mp->m_dir_geo->max_extents) return __this_address; --- a/fs/xfs/xfs_inode_item_recover.c +++ b/fs/xfs/xfs_inode_item_recover.c @@ -286,6 +286,7 @@ xlog_recover_inode_commit_pass2( struct xfs_log_dinode *ldip; uint isize; int need_free = 0; + xfs_failaddr_t fa; if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) { in_f = item->ri_buf[0].i_addr; @@ -530,8 +531,19 @@ out_owner_change: (dip->di_mode != 0)) error = xfs_recover_inode_owner_change(mp, dip, in_f, buffer_list); - /* re-generate the checksum. */ + /* re-generate the checksum and validate the recovered inode. */ xfs_dinode_calc_crc(log->l_mp, dip); + fa = xfs_dinode_verify(log->l_mp, in_f->ilf_ino, dip); + if (fa) { + XFS_CORRUPTION_ERROR( + "Bad dinode after recovery", + XFS_ERRLEVEL_LOW, mp, dip, sizeof(*dip)); + xfs_alert(mp, + "Metadata corruption detected at %pS, inode 0x%llx", + fa, in_f->ilf_ino); + error = -EFSCORRUPTED; + goto out_release; + } ASSERT(bp->b_mount == mp); bp->b_flags |= _XBF_LOGRECOVERY; Patches currently in stable-queue which might be from leah.rumancik@gmail.com are queue-6.1/xfs-allow-read-io-and-ficlone-to-run-concurrently.patch queue-6.1/xfs-hoist-freeing-of-rt-data-fork-extent-mappings.patch queue-6.1/xfs-make-sure-maxlen-is-still-congruent-with-prod-when-rounding-down.patch queue-6.1/xfs-only-remap-the-written-blocks-in-xfs_reflink_end_cow_extent.patch queue-6.1/xfs-dquot-recovery-does-not-validate-the-recovered-dquot.patch queue-6.1/xfs-clean-up-dqblk-extraction.patch queue-6.1/xfs-abort-intent-items-when-recovery-intents-fail.patch queue-6.1/xfs-up-ic_sema-if-flushing-data-device-fails.patch queue-6.1/xfs-fix-internal-error-from-agfl-exhaustion.patch queue-6.1/xfs-factor-out-xfs_defer_pending_abort.patch queue-6.1/xfs-fix-units-conversion-error-in-xfs_bmap_del_extent_delay.patch queue-6.1/xfs-bump-max-fsgeom-struct-version.patch queue-6.1/xfs-handle-nimaps-0-from-xfs_bmapi_write-in-xfs_alloc_file_space.patch queue-6.1/xfs-rt-stubs-should-return-negative-errnos-when-rt-disabled.patch queue-6.1/xfs-clean-up-fs_xflag_realtime-handling-in-xfs_ioctl_setattr_xflags.patch queue-6.1/xfs-respect-the-stable-writes-flag-on-the-rt-device.patch queue-6.1/xfs-introduce-protection-for-drop-nlink.patch queue-6.1/xfs-prevent-rt-growfs-when-quota-is-enabled.patch queue-6.1/xfs-inode-recovery-does-not-validate-the-recovered-inode.patch