[PATCH 0/1] fs: inotify: Add full paths option to inotify

From: Oliver Ford
Date: Mon Jun 06 2022 - 18:43:15 EST


Adds an option to return the full path in inotify events. Currently, user space has to keep track of watch descriptors and paths, mapping the descriptor returned when reading inotify events to the path. Adding an option to return the full path simplifies user space code.

The patch adds a flag, IN_FULL_PATHS, to the available mask in inotify_add_watch. When set, the full path is returned when events are added to the watch queue and a path is available. For the event IN_MOVE_SELF, a check is performed that the user has access to the new path. This prevents exposing the names of directories if, for example, root moves "/home/dmr/watched" to "/root/top_secret/watched". In that case, the watch is removed and a Permission Denied error is returned. For the IN_DELETE_SELF/IN_IGNORED pair, no path is returned.

Oliver Ford (1):
fs: inotify: Add full paths option to inotify

fs/notify/inotify/inotify_fsnotify.c | 55 ++++++++++++++++++++++------
fs/notify/inotify/inotify_user.c | 19 +++++++++-
include/linux/inotify.h | 2 +-
include/uapi/linux/inotify.h | 1 +
4 files changed, 63 insertions(+), 14 deletions(-)

--
2.35.1