linux/fs/cachefiles
David Howells a67632c8c2
cachefiles: Fix potential UAF/KASAN warning
Currently, trace_cachefiles_coherency() is being passed a pointer to a
__be64 lain over the coherency data in struct cachefiles_xattr so that it
can display the first 8 bytes.  However, the data is of variable length and
could even be 0 bytes.  This could lead to a UAF or KASAN warning.

Fix this by making sure the buffer has room for at least 8 bytes and that
those 8 bytes are pre-cleared.

Further, those bytes are not 8-byte aligned, so fix the tracepoint to
extract the data as four 2-byte words (they are 2-byte aligned) and
reassemble the __be64.  The compiler will convert this into a single 8-byte
load where the CPU supports it.

Fixes: 229105e5cf ("cachefiles: Add auxiliary data trace")
Link: https://sashiko.dev/#/patchset/20260810144746.574036-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/20260827134304.2075713-11-dhowells@redhat.com
Acked-by: Paulo Alcantara <pc@manguebit.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 09:54:38 +02:00
..
cache.c cachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie() 2024-07-03 10:36:15 +02:00
daemon.c cachefiles,netfs: sunset ondemand mode 2026-08-12 16:24:26 +02:00
error_inject.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
interface.c cachefiles,netfs: sunset ondemand mode 2026-08-12 16:24:26 +02:00
internal.h cachefiles,netfs: sunset ondemand mode 2026-08-12 16:24:26 +02:00
io.c cachefiles,netfs: sunset ondemand mode 2026-08-12 16:24:26 +02:00
Kconfig cachefiles,netfs: sunset ondemand mode 2026-08-12 16:24:26 +02:00
key.c vfs-6.16-rc1.async.dir 2025-05-26 08:02:43 -07:00
main.c cachefiles: Implement object lifecycle funcs 2022-01-07 13:42:08 +00:00
Makefile cachefiles,netfs: sunset ondemand mode 2026-08-12 16:24:26 +02:00
namei.c cachefiles,netfs: sunset ondemand mode 2026-08-12 16:24:26 +02:00
security.c cachefiles: Parse the "secctx" immediately 2024-12-20 22:07:56 +01:00
volume.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xattr.c cachefiles: Fix potential UAF/KASAN warning 2026-08-31 09:54:38 +02:00