mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
798352cb25
Last week, I was fiddling around with the metadump name obfuscation code while writing a debugger command to generate directories full of names that all have the same hash name. I had a few questions about how well all that worked with ascii-ci mode, and discovered a nasty discrepancy between the kernel and glibc's implementations of the tolower() function. I discovered that I could create a directory that is large enough to require separate leaf index blocks. The hashes stored in the dabtree use the ascii-ci specific hash function, which uses a library function to convert the name to lowercase before hashing. If the kernel and C library's versions of tolower do not behave exactly identically, xfs_ascii_ci_hashname will not produce the same results for the same inputs. xfs_repair will deem the leaf information corrupt and rebuild the directory. After that, lookups in the kernel will fail because the hash index doesn't work. The kernel's tolower function will convert extended ascii uppercase letters (e.g. A-with-umlaut) to extended ascii lowercase letters (e.g. a-with-umlaut), whereas glibc's will only do that if you force LANG to ascii. Tiny embedded libc implementations just plain won't do it at all, and the result is a mess. Stabilize the behavior of the hash function by encoding the name transformation function in libxfs, add it to the selftest, and fix all the userspace tools, none of which handle this transformation correctly. The v1 series generated a /lot/ of discussion, in which several things became very clear: (1) Linus is not enamored of case folding of any kind; (2) Dave and Christoph don't seem to agree on whether the feature is supposed to work for 7-bit ascii or latin1; (3) it trashes UTF8 encoded names if those happen to show up; and (4) I don't want to maintain this mess any longer than I have to. Kill it in 2030. v2: rename the functions to make it clear we're moving away from the letters t, o, l, o, w, e, and r; and deprecate the whole feature once we've fixed the bugs and added tests. Signed-off-by: Darrick J. Wong <djwong@kernel.org> -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQ2qTKExjcn+O1o2YRKO3ySh0YRpgUCZDYdqwAKCRBKO3ySh0YR pi33AQC4MFCz0uP1aF64zRgE+wtU2YBGw5cGps7nWIljVptbkAEAubfoY88wAop8 /KHIgZ8pHIb7ooPrYKpPZL5m0udtMw8= =3Up6 -----END PGP SIGNATURE----- Merge tag 'fix-asciici-bugs-6.4_2023-04-11' of git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into guilt/xfs-for-next xfs: fix ascii-ci problems, then kill it [v2] Last week, I was fiddling around with the metadump name obfuscation code while writing a debugger command to generate directories full of names that all have the same hash name. I had a few questions about how well all that worked with ascii-ci mode, and discovered a nasty discrepancy between the kernel and glibc's implementations of the tolower() function. I discovered that I could create a directory that is large enough to require separate leaf index blocks. The hashes stored in the dabtree use the ascii-ci specific hash function, which uses a library function to convert the name to lowercase before hashing. If the kernel and C library's versions of tolower do not behave exactly identically, xfs_ascii_ci_hashname will not produce the same results for the same inputs. xfs_repair will deem the leaf information corrupt and rebuild the directory. After that, lookups in the kernel will fail because the hash index doesn't work. The kernel's tolower function will convert extended ascii uppercase letters (e.g. A-with-umlaut) to extended ascii lowercase letters (e.g. a-with-umlaut), whereas glibc's will only do that if you force LANG to ascii. Tiny embedded libc implementations just plain won't do it at all, and the result is a mess. Stabilize the behavior of the hash function by encoding the name transformation function in libxfs, add it to the selftest, and fix all the userspace tools, none of which handle this transformation correctly. The v1 series generated a /lot/ of discussion, in which several things became very clear: (1) Linus is not enamored of case folding of any kind; (2) Dave and Christoph don't seem to agree on whether the feature is supposed to work for 7-bit ascii or latin1; (3) it trashes UTF8 encoded names if those happen to show up; and (4) I don't want to maintain this mess any longer than I have to. Kill it in 2030. v2: rename the functions to make it clear we're moving away from the letters t, o, l, o, w, e, and r; and deprecate the whole feature once we've fixed the bugs and added tests. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Dave Chinner <david@fromorbit.com> |
||
---|---|---|
.. | ||
libxfs | ||
scrub | ||
Kconfig | ||
kmem.c | ||
kmem.h | ||
Makefile | ||
mrlock.h | ||
xfs_acl.c | ||
xfs_acl.h | ||
xfs_aops.c | ||
xfs_aops.h | ||
xfs_attr_inactive.c | ||
xfs_attr_item.c | ||
xfs_attr_item.h | ||
xfs_attr_list.c | ||
xfs_bio_io.c | ||
xfs_bmap_item.c | ||
xfs_bmap_item.h | ||
xfs_bmap_util.c | ||
xfs_bmap_util.h | ||
xfs_buf_item_recover.c | ||
xfs_buf_item.c | ||
xfs_buf_item.h | ||
xfs_buf.c | ||
xfs_buf.h | ||
xfs_dahash_test.c | ||
xfs_dahash_test.h | ||
xfs_dir2_readdir.c | ||
xfs_discard.c | ||
xfs_discard.h | ||
xfs_dquot_item_recover.c | ||
xfs_dquot_item.c | ||
xfs_dquot_item.h | ||
xfs_dquot.c | ||
xfs_dquot.h | ||
xfs_drain.c | ||
xfs_drain.h | ||
xfs_error.c | ||
xfs_error.h | ||
xfs_export.c | ||
xfs_export.h | ||
xfs_extent_busy.c | ||
xfs_extent_busy.h | ||
xfs_extfree_item.c | ||
xfs_extfree_item.h | ||
xfs_file.c | ||
xfs_filestream.c | ||
xfs_filestream.h | ||
xfs_fsmap.c | ||
xfs_fsmap.h | ||
xfs_fsops.c | ||
xfs_fsops.h | ||
xfs_globals.c | ||
xfs_health.c | ||
xfs_icache.c | ||
xfs_icache.h | ||
xfs_icreate_item.c | ||
xfs_icreate_item.h | ||
xfs_inode_item_recover.c | ||
xfs_inode_item.c | ||
xfs_inode_item.h | ||
xfs_inode.c | ||
xfs_inode.h | ||
xfs_ioctl32.c | ||
xfs_ioctl32.h | ||
xfs_ioctl.c | ||
xfs_ioctl.h | ||
xfs_iomap.c | ||
xfs_iomap.h | ||
xfs_iops.c | ||
xfs_iops.h | ||
xfs_itable.c | ||
xfs_itable.h | ||
xfs_iunlink_item.c | ||
xfs_iunlink_item.h | ||
xfs_iwalk.c | ||
xfs_iwalk.h | ||
xfs_linux.h | ||
xfs_log_cil.c | ||
xfs_log_priv.h | ||
xfs_log_recover.c | ||
xfs_log.c | ||
xfs_log.h | ||
xfs_message.c | ||
xfs_message.h | ||
xfs_mount.c | ||
xfs_mount.h | ||
xfs_mru_cache.c | ||
xfs_mru_cache.h | ||
xfs_notify_failure.c | ||
xfs_ondisk.h | ||
xfs_pnfs.c | ||
xfs_pnfs.h | ||
xfs_pwork.c | ||
xfs_pwork.h | ||
xfs_qm_bhv.c | ||
xfs_qm_syscalls.c | ||
xfs_qm.c | ||
xfs_qm.h | ||
xfs_quota.h | ||
xfs_quotaops.c | ||
xfs_refcount_item.c | ||
xfs_refcount_item.h | ||
xfs_reflink.c | ||
xfs_reflink.h | ||
xfs_rmap_item.c | ||
xfs_rmap_item.h | ||
xfs_rtalloc.c | ||
xfs_rtalloc.h | ||
xfs_stats.c | ||
xfs_stats.h | ||
xfs_super.c | ||
xfs_super.h | ||
xfs_symlink.c | ||
xfs_symlink.h | ||
xfs_sysctl.c | ||
xfs_sysctl.h | ||
xfs_sysfs.c | ||
xfs_sysfs.h | ||
xfs_trace.c | ||
xfs_trace.h | ||
xfs_trans_ail.c | ||
xfs_trans_buf.c | ||
xfs_trans_dquot.c | ||
xfs_trans_priv.h | ||
xfs_trans.c | ||
xfs_trans.h | ||
xfs_xattr.c | ||
xfs_xattr.h | ||
xfs.h |