<feed xmlns='http://www.w3.org/2005/Atom'>
<title>laptop-kernel/fs/unicode, branch master</title>
<subtitle>Linux kernel tree for laptop</subtitle>
<id>https://git.zx2c4.com/laptop-kernel/atom/fs/unicode?h=master</id>
<link rel='self' href='https://git.zx2c4.com/laptop-kernel/atom/fs/unicode?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/'/>
<updated>2026-10-14T20:08:03Z</updated>
<entry>
<title>unicode: free the map after a grace period</title>
<updated>2026-10-14T20:08:03Z</updated>
<author>
<name>Christian Brauner</name>
<email>brauner@kernel.org</email>
</author>
<published>2026-10-09T21:51:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=a96c5299bd7305eb984377681eb3222a57376405'/>
<id>urn:sha1:a96c5299bd7305eb984377681eb3222a57376405</id>
<content type='text'>
generic_ci_d_hash() and generic_ci_d_compare() read sb-&gt;s_encoding and
dereference the unicode map while a pathwalk in rcu mode holds nothing
but rcu_read_lock(). The filesystems that use them, ext4, f2fs and
tmpfs, drop the map with utf8_unload() from -&gt;put_super(), which runs
when the last reference to the mount goes away. A lookup that is still
inside such a filesystem at that point reads a freed map.

With a pathwalk held up in utf8_casefold_hash() while the last reference
to a casefolded tmpfs goes away:

  BUG: KASAN: slab-use-after-free in utf8nlookup+0x74c/0x950
  Read of size 8 at addr ff110001030fe658 by task walker/98
  Call Trace:
   &lt;TASK&gt;
   utf8nlookup+0x74c/0x950
   utf8byte+0x160/0x1560
   utf8_casefold_hash+0x167/0x230
   generic_ci_d_hash+0xdd/0x1c0
   link_path_walk+0x11ad/0x1d30
   path_lookupat+0x63/0xb00
   filename_lookup+0x1f1/0x5b0
   vfs_statx+0xd7/0x3b0
  [...]
  Allocated by task 94:
   __kmalloc_cache_noprof+0x249/0x560
   utf8_load+0x4e/0x570
   shmem_parse_opt_casefold.isra.0+0x92/0x270
  [...]
  Freed by task 97:
   kfree+0x1db/0x5b0
   shmem_put_super+0x72/0x170
   generic_shutdown_super+0x14c/0x530
   kill_anon_super+0x3a/0x60
   deactivate_locked_super+0x9c/0xf0
   cleanup_mnt+0x9f/0x130

So far that has been hard to hit. umount(2) waits for a grace period
in namespace_unlock() before it drops the mount, so only a mount whose
last reference goes away elsewhere, like the close of a file or a chdir
out of a lazily unmounted directory, can race a walker. So it is
reachable.

Delay the free until a grace period has passed. The map and the data
table it holds a reference to then outlive any pathwalk that found the
superblock before the mount went away. The reference on the data table
module is dropped from the rcu callback as well. utf8-core is built in
whenever CONFIG_UNICODE is set, so there is no module exit that would
have to wait for the callbacks.

Overlayfs points the s_encoding of an overlay at the map of its first
layer without taking a reference of its own. That stays correct. The
layer is held by the overlay, so its map is dropped only after the
overlay is gone.

Fixes: b886ee3e778e ("ext4: Support case-insensitive file name lookups")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261009-work-fixes-rcu-v1-6-7446d2d335e6@kernel.org
Signed-off-by: Christian Brauner (Amutable) &lt;brauner@kernel.org&gt;
</content>
</entry>
<entry>
<title>unicode: Properly reject invalid encoding version strings</title>
<updated>2026-07-31T20:33:14Z</updated>
<author>
<name>Gabriel Krisman Bertazi</name>
<email>krisman@suse.de</email>
</author>
<published>2026-07-31T19:54:45Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=a511442085c140da9cdbe60e3f0fab1c71480801'/>
<id>urn:sha1:a511442085c140da9cdbe60e3f0fab1c71480801</id>
<content type='text'>
Casefolding filesystems can request a specific version of UTF-8 at
mount-time.  utf8_parse_version then assembles the "major.minor.rev"
string into an unsigned int.  There were two issues with the parser
logic: first, individual fields are read as signed int, allowing
negative numbers, second, an overflowed field will result in unexpected
results. Something like the below actually succeeds to mount using
utf8-12.1.0.

 mount -t tmpfs -o casefold=utf8-12.0.256 none /mnt
[   10.867859] tmpfs: Using encoding : utf8-12.1.0

Signed-off-by: Gabriel Krisman Bertazi &lt;krisman@suse.de&gt;
</content>
</entry>
<entry>
<title>utf8: Remove unused utf8_normalize</title>
<updated>2026-07-31T20:22:52Z</updated>
<author>
<name>Dr. David Alan Gilbert</name>
<email>linux@treblig.org</email>
</author>
<published>2025-06-09T01:19:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=080241946ec542ada349fced93936e2aebb51c75'/>
<id>urn:sha1:080241946ec542ada349fced93936e2aebb51c75</id>
<content type='text'>
utf8_normalize() was added in 2019 as part of
commit 9d53690f0d4e ("unicode: implement higher level API for string
handling")
but has remained unused.

(I think because the other higher level routines added by that patch
normalise as part of their operations)

Remove it.

Signed-off-by: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Signed-off-by: Gabriel Krisman Bertazi &lt;krisman@suse.de&gt;
</content>
</entry>
<entry>
<title>Convert 'alloc_obj' family to use the new default GFP_KERNEL argument</title>
<updated>2026-02-22T01:09:51Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-22T00:37:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43'/>
<id>urn:sha1:bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43</id>
<content type='text'>
This was done entirely with mindless brute force, using

    git grep -l '\&lt;k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace kmalloc with kmalloc_obj for non-scalar types</title>
<updated>2026-02-21T09:02:28Z</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2026-02-21T07:49:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=69050f8d6d075dc01af7a5f2f550a8067510366f'/>
<id>urn:sha1:69050f8d6d075dc01af7a5f2f550a8067510366f</id>
<content type='text'>
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>unicode: kunit: change tests filename and path</title>
<updated>2025-02-12T22:00:11Z</updated>
<author>
<name>Gabriela Bittencourt</name>
<email>gbittencourt@lkcamp.dev</email>
</author>
<published>2024-12-02T07:55:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=2be6ce9d9bd040780dda8d456fe8696a48d805be'/>
<id>urn:sha1:2be6ce9d9bd040780dda8d456fe8696a48d805be</id>
<content type='text'>
Change utf8 kunit test filename and path to follow the style
convention on Documentation/dev-tools/kunit/style.rst

Co-developed-by: Pedro Orlando &lt;porlando@lkcamp.dev&gt;
Signed-off-by: Pedro Orlando &lt;porlando@lkcamp.dev&gt;
Co-developed-by: Danilo Pereira &lt;dpereira@lkcamp.dev&gt;
Signed-off-by: Danilo Pereira &lt;dpereira@lkcamp.dev&gt;
Signed-off-by: Gabriela Bittencourt &lt;gbittencourt@lkcamp.dev&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Acked-by: Gabriel Krisman Bertazi &lt;krisman@suse.de&gt;
Reviewed-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Reviewed-by: Rae Moar &lt;rmoar@google.com&gt;
Link: https://lore.kernel.org/r/20241202075545.3648096-7-davidgow@google.com
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>unicode: kunit: refactor selftest to kunit tests</title>
<updated>2025-02-11T02:25:39Z</updated>
<author>
<name>Gabriela Bittencourt</name>
<email>gbittencourt@lkcamp.dev</email>
</author>
<published>2024-12-02T07:55:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=62b9ef504e7f89d6ae3e9ab704cc4befab1d37f0'/>
<id>urn:sha1:62b9ef504e7f89d6ae3e9ab704cc4befab1d37f0</id>
<content type='text'>
Refactoring 'test' functions into kunit tests, to test utf-8 support in
unicode subsystem.

This allows the utf8 tests to be run alongside the KUnit test suite
using kunit-tool, quickly compiling and running all desired tests as
part of the KUnit test suite, instead of compiling the selftest module
and loading it.

The refactoring kept the original testing logic intact, while adopting a
testing pattern across different kernel modules and leveraging KUnit's
benefits.

Co-developed-by: Pedro Orlando &lt;porlando@lkcamp.dev&gt;
Signed-off-by: Pedro Orlando &lt;porlando@lkcamp.dev&gt;
Co-developed-by: Danilo Pereira &lt;dpereira@lkcamp.dev&gt;
Signed-off-by: Danilo Pereira &lt;dpereira@lkcamp.dev&gt;
Signed-off-by: Gabriela Bittencourt &lt;gbittencourt@lkcamp.dev&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Acked-by: Gabriel Krisman Bertazi &lt;krisman@suse.de&gt;
Reviewed-by: Rae Moar &lt;rmoar@google.com&gt;
Link: https://lore.kernel.org/r/20241202075545.3648096-6-davidgow@google.com
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>Revert "unicode: Don't special case ignorable code points"</title>
<updated>2024-12-11T22:11:23Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-12-11T22:11:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=231825b2e1ff6ba799c5eaf396d3ab2354e37c6b'/>
<id>urn:sha1:231825b2e1ff6ba799c5eaf396d3ab2354e37c6b</id>
<content type='text'>
This reverts commit 5c26d2f1d3f5e4be3e196526bead29ecb139cf91.

It turns out that we can't do this, because while the old behavior of
ignoring ignorable code points was most definitely wrong, we have
case-folding filesystems with on-disk hash values with that wrong
behavior.

So now you can't look up those names, because they hash to something
different.

Of course, it's also entirely possible that in the meantime people have
created *new* files with the new ("more correct") case folding logic,
and reverting will just make other things break.

The correct solution is to not do case folding in filesystems, but
sadly, people seem to never really understand that.  People still see it
as a feature, not a bug.

Reported-by: Qi Han &lt;hanqi@vivo.com&gt;
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219586
Cc: Gabriel Krisman Bertazi &lt;krisman@suse.de&gt;
Requested-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'unicode-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/krisman/unicode</title>
<updated>2024-11-23T04:50:55Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-11-23T04:50:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=060fc106b6854d3289d838ac3c98eb17afb261d7'/>
<id>urn:sha1:060fc106b6854d3289d838ac3c98eb17afb261d7</id>
<content type='text'>
Pull unicode updates from Gabriel Krisman Bertazi:

 - constify a read-only struct (Thomas Weißschuh)

 - fix the error path of unicode_load, avoiding a possible kernel oops
   if it fails to find the unicode module (André Almeida)

 - documentation fix, updating a filename in the README (Gan Jie)

 - add the link of my tree to MAINTAINERS (André Almeida)

* tag 'unicode-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/krisman/unicode:
  MAINTAINERS: Add Unicode tree
  unicode: change the reference of database file
  unicode: Fix utf8_load() error path
  unicode: constify utf8 data table
</content>
</entry>
<entry>
<title>unicode: Recreate utf8_parse_version()</title>
<updated>2024-10-28T12:36:54Z</updated>
<author>
<name>André Almeida</name>
<email>andrealmeid@igalia.com</email>
</author>
<published>2024-10-21T16:37:20Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/laptop-kernel/commit/?id=142fa60f61f93805471012f24e029af6d113c5cc'/>
<id>urn:sha1:142fa60f61f93805471012f24e029af6d113c5cc</id>
<content type='text'>
All filesystems that currently support UTF-8 casefold can fetch the
UTF-8 version from the filesystem metadata stored on disk. They can get
the data stored and directly match it to a integer, so they can skip the
string parsing step, which motivated the removal of this function in the
first place.

However, for tmpfs, the only way to tell the kernel which UTF-8 version
we are about to use is via mount options, using a string. Re-introduce
utf8_parse_version() to be used by tmpfs.

This version differs from the original by skipping the intermediate step
of copying the version string to an auxiliary string before calling
match_token(). This versions calls match_token() in the argument string.
The paramenters are simpler now as well.

utf8_parse_version() was created by 9d53690f0d4 ("unicode: implement
higher level API for string handling") and later removed by 49bd03cc7e9
("unicode: pass a UNICODE_AGE() tripple to utf8_load").

Signed-off-by: André Almeida &lt;andrealmeid@igalia.com&gt;
Link: https://lore.kernel.org/r/20241021-tonyk-tmpfs-v8-4-f443d5814194@igalia.com
Reviewed-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Reviewed-by: Gabriel Krisman Bertazi &lt;krisman@suse.de&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
</feed>
