mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] fuse, fsnotify: handle embedded NUL names safely
@ 2026-11-17 13:51 Junyoung Jang
  2026-11-17 13:51 ` [PATCH v2 1/3] fuse: skip dcache instantiation for readdirplus names with embedded NUL Junyoung Jang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Junyoung Jang @ 2026-11-17 13:51 UTC (permalink / raw)
  To: Miklos Szeredi, Jan Kara
  Cc: Junyoung Jang, Amir Goldstein, Matt Bobrowski, Gwanhyun Lee,
	fuse-devel, linux-fsdevel, linux-kernel

FUSE READDIRPLUS can instantiate a dentry whose length-bearing name
contains an embedded NUL.  The fsnotify name-copy paths then stop at
that NUL while retaining the original qstr length, allowing event-name
buffers to expose uninitialized bytes.

Patch 1 skips dcache instantiation for these READDIRPLUS entries while
preserving getdents() behavior.  Patches 2 and 3 copy the full qstr name
into inotify and fanotify events.  Each patch applies independently to
the base commit.

Link: https://lore.kernel.org/linux-fsdevel/20261115210952.2140036-1-graypanda.inzag@gmail.com/

A custom LLM agent assisted with initial discovery and reproducer
setup; all root-cause analysis, patches, and runtime tests were
manually reviewed and verified by the authors.

---
Changes in v2:
- Follow Amir Goldstein's review: preserve FUSE readdir output and skip
  dcache instantiation only for invalid READDIRPLUS names.
- Replace the event-name strscpy_pad() calls with length-based memcpy()
  and explicit terminators in inotify and fanotify.

Tests on 23c62304dde2 in QEMU:
- Patch 1 alone: READDIR and READDIRPLUS getdents64() returned normally;
  the embedded-NUL entry was not instantiated, and FUSE_FORGET returned
  its unused lookup reference.
- Patch 2 alone: the FUSE READDIRPLUS/inotify reproducer returned the
  original qstr bytes after the NUL, with no stale slab bytes detected.
- Patch 3 alone: tmpfs FAN_REPORT_DFID_NAME creation and FAN_RENAME
  reported the expected names, NUL terminators, and zeroed alignment.
- All three together: the above FUSE and tmpfs regression probes passed.

Junyoung Jang (3):
  fuse: skip dcache instantiation for readdirplus names with embedded
    NUL
  inotify: copy full qstr length for event names
  fanotify: copy full qstr length for copied event names

 fs/fuse/readdir.c                    |  2 ++
 fs/notify/fanotify/fanotify.h        | 12 ++++++++++--
 fs/notify/inotify/inotify_fsnotify.c |  6 ++++--
 3 files changed, 16 insertions(+), 4 deletions(-)


base-commit: 23c62304dde29abe92013d85910d03a77dada35d

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

end of thread, other threads:[~2026-11-17 14:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 13:51 [PATCH v2 0/3] fuse, fsnotify: handle embedded NUL names safely Junyoung Jang
2026-11-17 13:51 ` [PATCH v2 1/3] fuse: skip dcache instantiation for readdirplus names with embedded NUL Junyoung Jang
2026-11-17 14:35   ` Amir Goldstein
2026-11-17 13:51 ` [PATCH v2 2/3] inotify: copy full qstr length for event names Junyoung Jang
2026-11-17 14:31   ` Amir Goldstein
2026-11-17 13:51 ` [PATCH v2 3/3] fanotify: copy full qstr length for copied " Junyoung Jang
2026-11-17 14:33   ` Amir Goldstein

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®