From: David Timber <dxdt@dev.snart.me>
To: Reid Downing <skibletz@gmail.com>,
linkinjeon@kernel.org, sj1557.seo@samsung.com
Cc: yuezhang.mo@sony.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exfat: fix upcase table validation to require all entries consumed
Date: Tue, 27 Oct 2026 08:01:26 +0000 [thread overview]
Message-ID: <99e3060d-10aa-4407-ab1c-43b7200ef76c@dev.snart.me> (raw)
In-Reply-To: <20261025122639.1173247-1-skibletz@gmail.com>
On 10/25/26 12:26, Reid Downing wrote:
> exfat_load_upcase_table() and exfat_load_default_upcase_table()
> accept the table when index >= 0xFFFF, but a correct table must
> process all 0x10000 entries, leaving index at 0x10000.
>
> a crafted filesystem image can use the compressed skip encoding
> to advance index to exactly 0xFFFF without filling the remaining
> entries. the checksum covers only the on-disk bytes so it can be
> made to match. the kernel accepts the table while the unfilled
> entries silently remain zero, causing incorrect uppercase mappings
> for the affected codepoints and breaking case-insensitive filename
> comparison for non-ascii characters.
>
> fix both checks to require index >= UTBL_COUNT.
>
> Fixes: 370e812b3ec1 ("exfat: add nls operations")
> Signed-off-by: Reid Downing <skibletz@gmail.com>
> ---
> fs/exfat/nls.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c
> index 055447edc..7afc86ea2 100644
> --- a/fs/exfat/nls.c
> +++ b/fs/exfat/nls.c
> @@ -691,7 +691,7 @@ static int exfat_load_upcase_table(struct super_block *sb,
> brelse(bh);
> }
>
> - if (index >= 0xFFFF && utbl_checksum == chksum)
> + if (index >= UTBL_COUNT && utbl_checksum == chksum)
> return 0;
>
> exfat_err(sb, "failed to load upcase table (idx : 0x%08x, chksum : 0x%08x, utbl_chksum : 0x%08x)",
> @@ -728,7 +728,7 @@ static int exfat_load_default_upcase_table(struct super_block *sb)
> }
> }
>
> - if (index >= 0xFFFF)
> + if (index >= UTBL_COUNT)
> return 0;
>
> /* FATAL error: default upcase table has error */
Please see the following unmerged patch:
https://lore.kernel.org/linux-fsdevel/20260414055643.1833401-5-dxdt@dev.snart.me/
How about
index == UTBL_COUNT
This is more of a compatibility issue than a security issue. A bit rot
in the storage hardware can definitely cause benign corruption. I've
observed that EXFAT.sys(the Windows implementation) strictly expects the
table to end exactly with 0x1000.
Also, expect the size of the table aligned to 2 bytes, as per my
original patch. You're more than welcome to cc me in the commit message.
I was just too busy to get back working on my patches.
Thanks,
Davo
prev parent reply other threads:[~2026-10-27 8:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 12:26 Reid Downing
2026-10-27 8:01 ` David Timber [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=99e3060d-10aa-4407-ab1c-43b7200ef76c@dev.snart.me \
--to=dxdt@dev.snart.me \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sj1557.seo@samsung.com \
--cc=skibletz@gmail.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®