From: Guikun Yang <yangguikun19@qq.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: ntfs3@lists.linux.dev, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: ntfs3: two out-of-bounds reads in $LogFile replay (restart page resize, restart table offset)
Date: Sat, 07 Nov 2026 22:00:00 +0800 [thread overview]
Message-ID: <tencent_427FA63F51443E005106A901DF6223E04E08@qq.com> (raw)
In-Reply-To: <c21c25-ntfs3-logfile-oob-20261106@qq.com>
Hi,
One more landing of the undo-pass lookup gap reported as item 3 - same
missing check, different field. The redo pass validates the
open-attribute table lookup three ways before using it; the undo pass
validates none of them.
Redo pass (fs/ntfs3/fslog.c:5105-5124):
t16 = le16_to_cpu(lrh->target_attr);
if (t16 >= bytes_per_rt(oatbl)) /* 1. bounds */
... goto out;
oe = Add2Ptr(oatbl, t16);
if (oe->next != RESTART_ENTRY_ALLOCATED_LE) /* 2. allocated */
... goto out;
oa = oe->ptr;
if (!oa) { /* 3. non-NULL */
... goto out;
}
Undo pass (fslog.c:5251):
oe = Add2Ptr(oatbl, le16_to_cpu(lrh->target_attr));
oa = oe->ptr;
t16 = le16_to_cpu(lrh->lcns_follow);
if (!t16)
goto add_allocated_vcns;
is_mapped = run_lookup_entry(oa->run1, ...);
Item 3 in my previous mail was the missing bounds check (an index past
the table reads outside the allocation). The same PoC with one field
changed - lcns_follow from 0 to 1 - selects an in-bounds but unused
entry (target_attr 0x18 points at entry 0 of a table with used=total=0,
so oe->ptr is NULL) and reaches run_lookup_entry(oa->run1, ...) with
oa == NULL:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
RIP: 0010:log_replay+0xabe6/0xf580 [ntfs3]
ntfs_loadlog_and_replay -> ntfs_fill_super
So one fix - mirroring all three redo-pass checks at the undo-pass
lookup, ideally in one helper shared by both - covers both landings and
the third one (in-bounds, allocated, but oe->ptr NULL) that I have not
built separately.
Both PoCs are the same four-record forged log as before, differing by
one field each; 3/3 with panic_on_warn=1, mount(2) alone, clean image
mounts fine. Unchanged in mainline as of 2026-11-07.
The reproducer bundle for items 3-5 plus this one is available on
request as a single archive - same base image, per-finding one-field
patches.
Thanks,
Guikun Yang
next prev parent reply other threads:[~2026-11-07 16:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c21c25-ntfs3-logfile-oob-20261106@qq.com>
2026-11-06 15:30 ` Guikun Yang
[not found] ` <c26c27-ntfs3-logfile-more-20261106@qq.com>
2026-11-07 14:00 ` Guikun Yang [this message]
2026-11-06 14:00 Guikun Yang
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_427FA63F51443E005106A901DF6223E04E08@qq.com \
--to=yangguikun19@qq.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/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®