On Mon, Jul 15, 2024 at 03:04:10PM +0200, Jan Kara wrote: > When __fsnotify_recalc_mask() recomputes the mask on the watched object, > the compiler can "optimize" the code to perform partial updates to the > mask (including zeroing it at the beginning). Thus places checking > the object mask without conn->lock such as fsnotify_object_watched() > could see invalid states of the mask. Make sure the mask update is > performed by one memory store using WRITE_ONCE(). > > Reported-by: syzbot+701037856c25b143f1ad@xxxxxxxxxxxxxxxxxxxxxxxxx > Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx> > Link: https://lore.kernel.org/all/CACT4Y+Zk0ohwwwHSD63U2-PQ=UuamXczr1mKBD6xtj2dyYKBvA@xxxxxxxxxxxxxx > Signed-off-by: Jan Kara <jack@xxxxxxx> I'm still hazy on the rules here and what KCSAN expects, but if we're using READ_ONCE/WRITE_ONCE on a thing, do we have to use them everywhere we access that member? Because there's a few accesses in include/linux/fsnotify_backend.h that were missed if so. Thanks, Josef