mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] hfsplus: fix "Illegal name" fsck failures from non-canonical decomposition
@ 2026-09-19  0:16 Viacheslav Dubeyko
  2026-09-19  0:16 ` [PATCH 1/3] hfsplus: add Unicode combining-class and legacy decomposition data Viacheslav Dubeyko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Viacheslav Dubeyko @ 2026-09-19  0:16 UTC (permalink / raw)
  To: glaubitz, frank.li
  Cc: linux-fsdevel, linux-kernel, vdubeyko, Viacheslav Dubeyko

The xfstests generic/339 (fsstress-style dirhash collision testing)
leaves an HFS+ volume corrupted and, as a result, fsck.hfsplus
reports a long run of "Illegal name".

The root cause is that fs/hfsplus/unicode.c's decomposition table
(Apple Technote #1150) decomposes each source character entirely on
its own and never does anything further with the result. Real fsck_hfs
has carried a permanent "FixDecomps" fixup in CatalogCheck.c for
exactly what that leaves unhandled:

 - combining marks contributed by two different source characters
   landing adjacent must be in ascending Unicode combining-class order,
   not just input order;
 - a small, fixed set of characters either weren't decomposed at all,
   or were decomposed into a sequence Apple corrected back in Mac OS X
   10.2 ("Jaguar"), and this driver's table still predates that.

A name that violates either of these gets flagged "Illegal name" by any
real macOS system (or fsck_hfs) that later reads the volume, even
though nothing else about it is wrong.

This series makes hfsplus store, hash and compare names the same way
current macOS does:

 1/3 adds the data: a Unicode combining-class table generated from UCD
     12.1.0, and two legacy-decomposition correction tables decoded
     programmatically from hfsprogs 540.1's own DecompData.h. Pure
     data, no behavior change.

 2/3 adds the logic that uses that data: canonical reordering of
     decomposed names, a fallback to the legacy decomposition table,
     and legacy sequence substitution, all applied in hfsplus_asc2uni()
     so this is what actually gets stored. hfsplus_hash_dentry() and
     hfsplus_compare_dentry() are reworked to canonicalize names the
     same way, so a lookup can't disagree with what a create() of the
     same name actually wrote.

 3/3 adds KUnit coverage for both: reordering, stability of equal-class
     marks, the legacy decomposition and sequence fixups, and that
     hashing/comparison agree across differently-typed-but-equivalent
     spellings of the same name.

Viacheslav Dubeyko (3):
  hfsplus: add Unicode combining-class and legacy decomposition data
  hfsplus: canonicalize decomposed catalog names like fsck_hfs expects
  hfsplus: add KUnit coverage for canonical reordering and legacy fixups

 fs/hfsplus/hfsplus_fs.h   |   6 +-
 fs/hfsplus/tables.c       | 496 ++++++++++++++++++++++++++++++++++++++
 fs/hfsplus/unicode.c      | 390 ++++++++++++++++++++----------
 fs/hfsplus/unicode.h      |  63 +++++
 fs/hfsplus/unicode_test.c | 309 ++++++++++++++++++++++++
 5 files changed, 1127 insertions(+), 137 deletions(-)
 create mode 100644 fs/hfsplus/unicode.h

-- 
2.43.0


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

end of thread, other threads:[~2026-09-19  0:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-19  0:16 [PATCH 0/3] hfsplus: fix "Illegal name" fsck failures from non-canonical decomposition Viacheslav Dubeyko
2026-09-19  0:16 ` [PATCH 1/3] hfsplus: add Unicode combining-class and legacy decomposition data Viacheslav Dubeyko
2026-09-19  0:16 ` [PATCH 2/3] hfsplus: canonicalize decomposed catalog names like fsck_hfs expects Viacheslav Dubeyko
2026-09-19  0:16 ` [PATCH 3/3] hfsplus: add KUnit coverage for canonical reordering and legacy fixups Viacheslav Dubeyko

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®