[PATCH v2 0/3] fsnotify: fix races on mark mask, flags and ignore mask
From: Seiji Nishikawa
Date: Sun Dec 06 2026 - 03:07:16 EST
This is v2 of "inotify: do not expose a zero mask while replacing a
watch" [1]. In the review of v1, Jan pointed out that more places need
the same treatment, on the read side and on the write side, and that
send_to_group() clears the ignore mask without a lock and races with the
other updates of the ignore mask. This series covers these points.
Patch 1 is the v1 patch. Patch 2 clears the ignore mask under
mark->lock. Patch 3 adds READ_ONCE() to the remaining reads of
mark->mask, mark->flags and mark->ignore_mask that are done without
mark->lock, and WRITE_ONCE() to the remaining writes of these fields.
[1] https://lore.kernel.org/all/20261019230320.1855016-1-snishika@xxxxxxxxxx/
Seiji Nishikawa (3):
inotify: do not expose a zero mask while replacing a watch
fsnotify: clear the ignore mask under mark->lock
fsnotify: annotate lockless accesses to mark masks and flags
fs/notify/dnotify/dnotify.c | 2 +-
fs/notify/fanotify/fanotify.c | 12 +++++++----
fs/notify/fanotify/fanotify.h | 7 +++---
fs/notify/fanotify/fanotify_user.c | 32 +++++++++++++++++-----------
fs/notify/fdinfo.c | 10 +++++----
fs/notify/fsnotify.c | 24 ++++++++++++++++-----
fs/notify/inotify/inotify.h | 7 +++---
fs/notify/inotify/inotify_fsnotify.c | 2 +-
fs/notify/inotify/inotify_user.c | 17 +++++++++++----
fs/notify/mark.c | 32 ++++++++++++++++------------
include/linux/fsnotify_backend.h | 17 ++++++++-------
11 files changed, 103 insertions(+), 59 deletions(-)
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.43.0