diff options
| author | Matthias Goergens <matthias.goergens@gmail.com> | 2026-09-26 10:08:51 +0800 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2026-10-08 13:51:31 +0200 |
| commit | ff05910cb1b77c2b229c5e6e260c6173a17b579b (patch) | |
| tree | 0989674cd7ca73a02aa7fd14322ff166ef16edce /include/uapi/linux/errqueue.h | |
| parent | 4ecb68572a96709aecaa9a1b4f1e908c45c2c346 (diff) | |
| download | linux-next-ff05910cb1b77c2b229c5e6e260c6173a17b579b.tar.gz linux-next-ff05910cb1b77c2b229c5e6e260c6173a17b579b.zip | |
fanotify: report names longer than NAME_MAX
fanotify keeps the length of a reported name in a u8, so it drops any
name longer than NAME_MAX and warns:
WARNING: fs/notify/fanotify/fanotify.h:217 at fanotify_handle_event+0x2e82/0x39f0
Such names are legitimate on some filesystems. vfat mounted with utf8
takes up to 255 UTF-16 characters, which are up to 765 bytes of UTF-8,
and FUSE accepts names up to PATH_MAX - 1. readdir() and inotify report
them in full. fanotify sends the event without the name, and for
FAN_RENAME it trips a second warning in copy_fid_info_to_user(), after
which read() fails with EFAULT and the event is lost.
When syzbot hit this, Jan suggested accommodating names up to PATH_MAX
[1], the limit readdir() already applies to a name
(verify_dirent_name()). Store the name lengths as u16, which keeps
struct fanotify_info at 8 bytes, and drop without a warning only names
of PATH_MAX bytes or more, which no path can refer to. An event with
such a name can exceed a page, so allocate name events with kvmalloc(),
as Jan also suggested. Names up to NAME_MAX are reported exactly as
before, and the record format is unchanged: an event with a long name is
just longer.
Link: https://lore.kernel.org/all/20241112115059.ecvomkalee5m4i4i@quack3/ [1]
Fixes: 2d9374f09513 ("fanotify: use macros to get the offset to fanotify_info buffer")
Cc: stable@vger.kernel.org
Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com>
Link: https://patch.msgid.link/20260926020851.2938961-1-matthias.goergens@gmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include/uapi/linux/errqueue.h')
0 files changed, 0 insertions, 0 deletions
