Linux-f2fs-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH 0/3] fs: reject casefolded names that fold to ".", "..", or empty
@ 2026-11-13  6:53 Sarthak Kukreti via Linux-f2fs-devel
  2026-11-13  6:53 ` [f2fs-dev] [PATCH 1/3] libfs: " Sarthak Kukreti via Linux-f2fs-devel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sarthak Kukreti via Linux-f2fs-devel @ 2026-11-13  6:53 UTC (permalink / raw)
  To: Theodore Ts'o, Jaegeuk Kim, Chao Yu, Alexander Viro,
	Christian Brauner
  Cc: Eric Biggers, Sarthak Kukreti, linux-kernel, linux-f2fs-devel,
	linux-fsdevel, linux-ext4, Gabriel Krisman Bertazi,
	Dmitry Torokhov

Unicode normalization in fs/unicode strips Default_Ignorable_Code_Point
characters (such as U+202E RIGHT-TO-LEFT OVERRIDE and U+200B ZERO WIDTH
SPACE) in both UTF8_NFDI and UTF8_NFDICF. In casefolded directories,
filenames consisting of 0 to 2 ASCII dots plus ignorable code points
(e.g. "\u202e", ".\u202e", "..\u202e") pass VFS path walk as normal
multi-byte components, but fold to "", ".", or ".." in utf8_casefold():

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).
3. Filenames consisting solely of ignorable characters fold to "" (0
   bytes), causing distinct ignorable-only filenames to hash and compare
   equal and creating entries that e2fsck flags as corruption.

This series rejects casefolding and case-insensitive matching of names
that fold to "", ".", or ".." across libfs (d_hash, d_compare,
generic_ci_match, and generic_ci_validate_strict_name), ext4
(ext4_fname_setup_ci_filename and ext4fs_dirhash), and f2fs
(f2fs_init_casefolded_name), while preserving exact byte-equality
matching for genuine "." and ".." lookups (such as NFS ext4_get_parent)
and opaque byte fallback for invalid UTF-8 sequences in non-strict mode.

Dmitry Torokhov (1):
  f2fs: reject casefolded names that fold to ".", "..", or empty

Sarthak Kukreti (2):
  libfs: reject casefolded names that fold to ".", "..", or empty
  ext4: reject casefolded names that fold to ".", "..", or empty

 fs/ext4/hash-test.c | 12 ++++++++++++
 fs/ext4/hash.c      |  2 +-
 fs/ext4/namei.c     | 11 +++++++++--
 fs/f2fs/dir.c       |  6 +++++-
 fs/libfs.c          | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 include/linux/fs.h  | 29 +++++++++++++----------------
 6 files changed, 91 insertions(+), 21 deletions(-)

-- 
2.56.0.611.g1030f0b940-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-13  8:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13  6:53 [f2fs-dev] [PATCH 0/3] fs: reject casefolded names that fold to ".", "..", or empty Sarthak Kukreti via Linux-f2fs-devel
2026-11-13  6:53 ` [f2fs-dev] [PATCH 1/3] libfs: " Sarthak Kukreti via Linux-f2fs-devel
2026-11-13  7:27   ` sashiko-bot--- via Linux-f2fs-devel
2026-11-13  6:53 ` [f2fs-dev] [PATCH 2/3] ext4: " Sarthak Kukreti via Linux-f2fs-devel
2026-11-13  6:53 ` [f2fs-dev] [PATCH 3/3] f2fs: " Sarthak Kukreti via Linux-f2fs-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox