From: Al Viro <viro@zeniv.linux.org.uk>
To: Theodore Tso <tytso@mit.edu>
Cc: David Laight <david.laight.linux@gmail.com>,
Gabriel Krisman Bertazi <krisman@suse.de>,
Sarthak Kukreti <sarthakkukreti@google.com>,
Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>,
Christian Brauner <brauner@kernel.org>,
Gabriel Krisman Bertazi <krisman@collabora.co.uk>,
Eric Biggers <ebiggers@google.com>,
Dmitry Torokhov <dtor@google.com>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] libfs: reject casefolded names that fold to ".", "..", or empty
Date: Tue, 17 Nov 2026 17:59:17 +0000 [thread overview]
Message-ID: <20261117175917.GO989762@ZenIV> (raw)
In-Reply-To: <avxe5v6r1C7ZG7E2@mit.edu>
On Tue, Nov 17, 2026 at 09:54:32AM -0500, Theodore Tso wrote:
> On Tue, Nov 17, 2026 at 08:47:27AM -0500, David Laight wrote:
> > > Sigh... I really think these characters are *evil*. I wonder if we
> > > should simply drop those code points unconditionally when they are fed
> > > to the kernel --- not only folding to themselves, but *not* preserving
> > > them when a misguided application tries to create a file with one of
> > > these misbegotten Unicode charactesr.
> >
> > Doesn't that assume that filenames are UTF8 rather than just sequences
> > of bytes with everything except '\0' and '/' being valid.
> > Casefolding is itself so evil/impossible it shouldn't have been allowed.
>
> We would only do this if casefolding is enabled.
Which is to say, on any distro kernel. Besides, it's not just a matter of
filtering that dreck out on getname() and friends (syscall boundary won't
do at all due to the things like binfmt_misc opening files, etc.) - you'd
need to scan what you get upon ->get_link() as well.
> For better or for
> worse, it's better than what it replaced which was this terrible
> wrapfs hack that was a trivial to trigger deadlocks using fsstress ---
> which was even more evil.
>
> The other way we can deal with this is that if case folding is
> enabled, we change the VFS to call the case-folding for incoming
> filename *before* it does its special case checking for '.' and '..'
> if casefolding is enabled.
That would penalize every pathname resolution, whether that misfeature is
stepped into or not; hash_name() is fairly hot.
'.' and '..' should be recognized only as literal octet sequences 0x2e
and 0x2e 0x2e; if some misguided filesystem decides to treat something
else as equivalent to those, it bloody well ought to recognize and reject
that something else in its ->lookup() (or ->d_hash(), for that matter).
WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@zeniv.linux.org.uk>
To: Theodore Tso <tytso@mit.edu>
Cc: Gabriel Krisman Bertazi <krisman@suse.de>,
Christian Brauner <brauner@kernel.org>,
Eric Biggers <ebiggers@google.com>,
Sarthak Kukreti <sarthakkukreti@google.com>,
David Laight <david.laight.linux@gmail.com>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>,
linux-ext4@vger.kernel.org,
Gabriel Krisman Bertazi <krisman@collabora.co.uk>,
Dmitry Torokhov <dtor@google.com>
Subject: Re: [f2fs-dev] [PATCH 1/3] libfs: reject casefolded names that fold to ".", "..", or empty
Date: Tue, 17 Nov 2026 17:59:17 +0000 [thread overview]
Message-ID: <20261117175917.GO989762@ZenIV> (raw)
In-Reply-To: <avxe5v6r1C7ZG7E2@mit.edu>
On Tue, Nov 17, 2026 at 09:54:32AM -0500, Theodore Tso wrote:
> On Tue, Nov 17, 2026 at 08:47:27AM -0500, David Laight wrote:
> > > Sigh... I really think these characters are *evil*. I wonder if we
> > > should simply drop those code points unconditionally when they are fed
> > > to the kernel --- not only folding to themselves, but *not* preserving
> > > them when a misguided application tries to create a file with one of
> > > these misbegotten Unicode charactesr.
> >
> > Doesn't that assume that filenames are UTF8 rather than just sequences
> > of bytes with everything except '\0' and '/' being valid.
> > Casefolding is itself so evil/impossible it shouldn't have been allowed.
>
> We would only do this if casefolding is enabled.
Which is to say, on any distro kernel. Besides, it's not just a matter of
filtering that dreck out on getname() and friends (syscall boundary won't
do at all due to the things like binfmt_misc opening files, etc.) - you'd
need to scan what you get upon ->get_link() as well.
> For better or for
> worse, it's better than what it replaced which was this terrible
> wrapfs hack that was a trivial to trigger deadlocks using fsstress ---
> which was even more evil.
>
> The other way we can deal with this is that if case folding is
> enabled, we change the VFS to call the case-folding for incoming
> filename *before* it does its special case checking for '.' and '..'
> if casefolding is enabled.
That would penalize every pathname resolution, whether that misfeature is
stepped into or not; hash_name() is fairly hot.
'.' and '..' should be recognized only as literal octet sequences 0x2e
and 0x2e 0x2e; if some misguided filesystem decides to treat something
else as equivalent to those, it bloody well ought to recognize and reject
that something else in its ->lookup() (or ->d_hash(), for that matter).
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-11-17 17:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 6:53 [PATCH 0/3] fs: reject casefolded names that fold to ".", "..", or empty Sarthak Kukreti
2026-11-13 6:53 ` [f2fs-dev] " Sarthak Kukreti via Linux-f2fs-devel
2026-11-13 6:53 ` [PATCH 1/3] libfs: " Sarthak Kukreti
2026-11-13 6:53 ` [f2fs-dev] " Sarthak Kukreti via Linux-f2fs-devel
2026-11-13 7:27 ` sashiko-bot
2026-11-13 7:27 ` sashiko-bot--- via Linux-f2fs-devel
2026-11-16 19:34 ` Gabriel Krisman Bertazi
2026-11-16 19:34 ` [f2fs-dev] " Gabriel Krisman Bertazi
2026-11-16 20:05 ` Eric Biggers
2026-11-16 20:05 ` [f2fs-dev] " Eric Biggers via Linux-f2fs-devel
2026-11-17 2:00 ` Theodore Tso
2026-11-17 2:00 ` [f2fs-dev] " Theodore Tso
2026-11-17 8:47 ` David Laight
2026-11-17 8:47 ` [f2fs-dev] " David Laight
2026-11-17 14:54 ` Theodore Tso
2026-11-17 14:54 ` [f2fs-dev] " Theodore Tso
2026-11-17 17:59 ` Al Viro [this message]
2026-11-17 17:59 ` Al Viro
2026-11-17 19:39 ` David Laight
2026-11-17 19:39 ` [f2fs-dev] " David Laight
2026-11-17 2:44 ` Sarthak Kukreti
2026-11-17 2:44 ` [f2fs-dev] " Sarthak Kukreti via Linux-f2fs-devel
2026-11-13 6:53 ` [PATCH 2/3] ext4: " Sarthak Kukreti
2026-11-13 6:53 ` [f2fs-dev] " Sarthak Kukreti via Linux-f2fs-devel
2026-11-13 7:04 ` sashiko-bot
2026-11-13 6:53 ` [PATCH 3/3] f2fs: " Sarthak Kukreti
2026-11-13 6:53 ` [f2fs-dev] " Sarthak Kukreti via Linux-f2fs-devel
2026-11-13 7:00 ` sashiko-bot
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=20261117175917.GO989762@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=david.laight.linux@gmail.com \
--cc=dtor@google.com \
--cc=ebiggers@google.com \
--cc=jaegeuk@kernel.org \
--cc=krisman@collabora.co.uk \
--cc=krisman@suse.de \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sarthakkukreti@google.com \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.