diff options
author | Amir Goldstein <amir73il@gmail.com> | 2024-10-03 17:29:22 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2024-10-16 18:43:05 +0300 |
commit | 522249f05c5551aec9ec0ba9b6438f1ec19c138d (patch) | |
tree | 91770331ebee3329d4945d4cb87a11374b3196cd /tools/perf/scripts/python/gecko.py | |
parent | 1cda52f1b4611f4daa9d89e69d9428fb4137dc3f (diff) | |
download | linux-522249f05c5551aec9ec0ba9b6438f1ec19c138d.tar.xz |
fanotify: allow reporting errors on failure to open fd
When working in "fd mode", fanotify_read() needs to open an fd
from a dentry to report event->fd to userspace.
Opening an fd from dentry can fail for several reasons.
For example, when tasks are gone and we try to open their
/proc files or we try to open a WRONLY file like in sysfs
or when trying to open a file that was deleted on the
remote network server.
Add a new flag FAN_REPORT_FD_ERROR for fanotify_init().
For a group with FAN_REPORT_FD_ERROR, we will send the
event with the error instead of the open fd, otherwise
userspace may not get the error at all.
For an overflow event, we report -EBADF to avoid confusing FAN_NOFD
with -EPERM. Similarly for pidfd open errors we report either -ESRCH
or the open error instead of FAN_NOPIDFD and FAN_EPIDFD.
In any case, userspace will not know which file failed to
open, so add a debug print for further investigation.
Reported-by: Krishna Vivek Vitta <kvitta@microsoft.com>
Link: https://lore.kernel.org/linux-fsdevel/SI2P153MB07182F3424619EDDD1F393EED46D2@SI2P153MB0718.APCP153.PROD.OUTLOOK.COM/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20241003142922.111539-1-amir73il@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/gecko.py')
0 files changed, 0 insertions, 0 deletions