Re: [PATCH 1/3] libfs: reject casefolded names that fold to ".", "..", or empty

From: Eric Biggers

Date: Mon Nov 16 2026 - 15:05:41 EST


On Mon, Nov 16, 2026 at 02:34:26PM -0500, Gabriel Krisman Bertazi wrote:
> Hi Sarthak,
>
> Ugh. I agree this is a problem, but I'm also trying to understand first
> the real impact beyond filesystem complaints during lookup, if any:
>
> 1. Looking up ".\u202e" folds to "." and matches the on-disk "." entry
> (de->inode == dir->i_ino) in generic_ci_match(), triggering
> EXT4_ERROR_INODE ("linked to parent dir") in ext4_lookup().
> 2. Looking up "..\u202e" folds to ".." and matches the on-disk ".."
> entry, returning -ELOOP via d_splice_alias() (or triggering
> EXT4_ERROR_INODE on the root directory).
>
> These two look like a "do stupid things, get stupid prizes" with no
> further repercussions beyond the error message. Sure, we can fix them
> to throw EINVAL, but are there bigger repercussions I'm missing?

For one: if the filesystem is mounted with errors=remount-ro or
errors=panic, then EXT4_ERROR_INODE is more than a log message.

> But the way I'd suggest be handled is by rejecting the ignorable code
> points lookup (all, but variant selectors for the reasons above), early
> in the lookup path for case-insensitive directories so they never even
> get to the filesystem. Wdyt?

If variation selectors are still allowed (e.g., "..\ufe00", that
wouldn't actually fix this bug though, right?

- Eric