Skip to content

Commit 9a903e6

Browse files
committed
Merge tag 'fsnotify_for_v6.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull fsnotify fixes from Jan Kara: "Two fsnotify fixes. The fix from Ahelenia makes sure we generate event when modifying inode flags, the fix from Amir disables sending of events from device inodes to their parent directory as it could concievably create a usable side channel attack in case of some devices and so far we aren't aware of anybody depending on the functionality" * tag 'fsnotify_for_v6.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: fs: send fsnotify_xattr()/IN_ATTRIB from vfs_fileattr_set()/chattr(1) fsnotify: do not generate ACCESS/MODIFY events on child for special files
2 parents ea1013c + 6f7c877 commit 9a903e6

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

fs/file_attr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <linux/fs.h>
33
#include <linux/security.h>
44
#include <linux/fscrypt.h>
5+
#include <linux/fsnotify.h>
56
#include <linux/fileattr.h>
67
#include <linux/export.h>
78
#include <linux/syscalls.h>
@@ -298,6 +299,7 @@ int vfs_fileattr_set(struct mnt_idmap *idmap, struct dentry *dentry,
298299
err = inode->i_op->fileattr_set(idmap, dentry, fa);
299300
if (err)
300301
goto out;
302+
fsnotify_xattr(dentry);
301303
}
302304

303305
out:

fs/notify/fsnotify.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,15 @@ int __fsnotify_parent(struct dentry *dentry, __u32 mask, const void *data,
270270
/*
271271
* Include parent/name in notification either if some notification
272272
* groups require parent info or the parent is interested in this event.
273+
* The parent interest in ACCESS/MODIFY events does not apply to special
274+
* files, where read/write are not on the filesystem of the parent and
275+
* events can provide an undesirable side-channel for information
276+
* exfiltration.
273277
*/
274-
parent_interested = mask & p_mask & ALL_FSNOTIFY_EVENTS;
278+
parent_interested = mask & p_mask & ALL_FSNOTIFY_EVENTS &&
279+
!(data_type == FSNOTIFY_EVENT_PATH &&
280+
d_is_special(dentry) &&
281+
(mask & (FS_ACCESS | FS_MODIFY)));
275282
if (parent_needed || parent_interested) {
276283
/* When notifying parent, child should be passed as data */
277284
WARN_ON_ONCE(inode != fsnotify_data_inode(data, data_type));

0 commit comments

Comments
 (0)