fuse, fsnotify: handle embedded NUL names safely
Status from this message: Applied, thanks.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest3 patches 5 repliesApplied
- v13 patches 5 repliesSuperseded
Changes in v2 from the cover letter
- 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.
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | fuse: skip dcache instantiation for readdirplus names with embedded NULfs/ | +2 | 2 replies | |
| 2/3 | inotify: copy full qstr length for event namesfs/ | +4 | 1 reply | |
| 3/3 | fanotify: copy full qstr length for copied event namesfs/ | +10 | 1 reply |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Amir Goldstein |
|---|---|
| 1/3 | R-b |
| 2/3 | R-b |
| 3/3 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/3] fuse, fsnotify: handle embedded NUL names safely
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.
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