From: Guikun Yang <yangguikun19@qq.com>
To: Carlos Maiolino <cem@kernel.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Bug report] xfs: unvalidated ilf_boffset in an inode log item reaches an out-of-bounds read during log recovery
Date: Sun, 08 Nov 2026 14:00:00 +0800 [thread overview]
Message-ID: <tencent_4E67A4DE89D134238ADA273B4A2095ECDB05@qq.com> (raw)
In-Reply-To: <x1-xfs-ilf-boffset-20261031@qq.com>
Hi,
Following up on this report from October 31 with a re-check against
current mainline (2026-11-08) and a smaller reproducer.
## Current state
xfs_buf_offset() is still a raw pointer add:
return bp->b_addr + offset;
and ilf_boffset is still used through it exactly once in the tree -
the bare call in xlog_recover_inode_commit_pass2()
(fs/xfs/xfs_inode_item_recover.c):
dip = xfs_buf_offset(bp, in_f->ilf_boffset);
if (XFS_IS_CORRUPT(mp, !xfs_verify_magic16(bp, dip->di_magic)))
Nothing bounds ilf_boffset against the buffer that ilf_len bought.
The xfs_verify_magic16() comparison cannot help - it inspects a value
that has already been read out of bounds.
For what it is worth, the inode-item fork regions in this same
function gained bounds in 9232301894 ("xfs: bound inode fork length
against the fork size during log recovery", 2026-09-23), but the
record carries more fields than that fix covered: the buffer length
(ilf_len) and the buffer offset (ilf_boffset) are both still trusted
as-is.
## Smaller reproducer
The original report used a three-step image construction. The same
crash now reproduces with five bytes changed on a real dirty-log
image: ilf_boffset from 0 to 16384 (= BBTOB(ilf_len)) plus the four
CRC bytes of the log record. The unmodified image recovers and mounts
cleanly; the modified one hits
BUG: KASAN: use-after-free in xlog_recover_inode_commit_pass2+...
...
xlog_recover_inode_commit_pass2 -> ... -> xfs_log_recover -> mount
3/3 at mount(2), with panic_on_warn=1.
The reproducer (log scanner, image builder, ready-made image, serial
log) is available on request. Happy to test a patch - including one
revived from the October RFC series if that is the preferred route.
Thanks,
Guikun Yang
parent reply other threads:[~2026-11-08 17:12 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <c34-xfs-ilf-len-oob-20261108@qq.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_4E67A4DE89D134238ADA273B4A2095ECDB05@qq.com \
--to=yangguikun19@qq.com \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®