From: Bryam Vargas <hexlabsecurity@proton.me>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: Sungjong Seo <sj1557.seo@samsung.com>,
Yuezhang Mo <yuezhang.mo@sony.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exfat: bound uniname advance in exfat_find_dir_entry()
Date: Fri, 12 Jun 2026 19:30:16 +0000 [thread overview]
Message-ID: <20260612193010.23238-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <CAKYAXd8OEYeqVfKFyHR6kLJdLvfcfsdUSsNfXB-j93JyARJhNg@mail.gmail.com>
You're right -- by the time the check runs, uniname has already been advanced
by the previous iterations, so `uniname + len` forms a pointer past the end of
p_uniname->name[] (undefined behavior; the compiler is free to drop the check).
Bounding the integer offset before the pointer is formed is the correct fix.
v2 uses your form -- compute offset = (++order - 2) * EXFAT_FILE_NAME_LEN, reject
when offset > MAX_NAME_LENGTH || len > MAX_NAME_LENGTH - offset, and only then set
uniname = p_uniname->name + offset. Carried as Suggested-by: you.
I re-ran the KASAN repro with your version on the same crafted image (high
SecondaryCount of all-NUL name entries): the bound now rejects the walk at
order 20 (offset 270 > 255) before any out-of-bounds pointer is formed, the
lookup returns -ENOENT, and there is no KASAN report. A legitimate 255-character
name (17 * 15) still resolves -- offset reaches 240 on the last entry, len 15,
240 + 15 = 255, within bounds.
Posted as v2: https://lore.kernel.org/all/20260612-b4-disp-d3abc2b6-v2-1-93ec15095270@proton.me/
prev parent reply other threads:[~2026-06-12 19:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 3:45 Bryam Vargas via B4 Relay
2026-06-12 14:04 ` Namjae Jeon
2026-06-12 19:30 ` Bryam Vargas [this message]
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=20260612193010.23238-1-hexlabsecurity@proton.me \
--to=hexlabsecurity@proton.me \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sj1557.seo@samsung.com \
--cc=yuezhang.mo@sony.com \
/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®