linux/fs/notify
Amir Goldstein 7a93edb23b fsnotify: do not generate ACCESS/MODIFY events on child for special files
commit 635bc4def0 upstream.

inotify/fanotify do not allow users with no read access to a file to
subscribe to events (e.g. IN_ACCESS/IN_MODIFY), but they do allow the
same user to subscribe for watching events on children when the user
has access to the parent directory (e.g. /dev).

Users with no read access to a file but with read access to its parent
directory can still stat the file and see if it was accessed/modified
via atime/mtime change.

The same is not true for special files (e.g. /dev/null). Users will not
generally observe atime/mtime changes when other users read/write to
special files, only when someone sets atime/mtime via utimensat().

Align fsnotify events with this stat behavior and do not generate
ACCESS/MODIFY events to parent watchers on read/write of special files.
The events are still generated to parent watchers on utimensat(). This
closes some side-channels that could be possibly used for information
exfiltration [1].

[1] https://snee.la/pdf/pubs/file-notification-attacks.pdf

Reported-by: Sudheendra Raghav Neela <sneela@tugraz.at>
CC: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-01-02 12:57:23 +01:00
..
dnotify fix a leak in fcntl_dirnotify() 2025-07-14 10:13:31 +02:00
fanotify fanotify: add watchdog for permission events 2025-09-11 16:34:50 +02:00
inotify fsnotify: fix "rewriten"->"rewritten" 2025-09-02 14:37:33 +02:00
fdinfo.c fs/notify: call exportfs_encode_fid with s_umount 2025-10-06 16:31:52 +02:00
fdinfo.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fsnotify.c fsnotify: do not generate ACCESS/MODIFY events on child for special files 2026-01-02 12:57:23 +01:00
fsnotify.h fsnotify: add mount notification infrastructure 2025-02-04 11:14:47 +01:00
group.c inotify: Fix possible deadlock in fsnotify_destroy_mark 2024-10-02 15:14:29 +02:00
Kconfig fs/notify: Remove "select SRCU" 2023-02-02 16:26:06 -08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mark.c fs: replace use of system_unbound_wq with system_dfl_wq 2025-09-19 16:15:07 +02:00
notification.c fsnotify: Pass group argument to free_event 2021-10-27 12:34:18 +02:00