From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH v3 0/2] User namespace aware fanotify
Date: Fri, 16 May 2025 21:28:01 +0200 [thread overview]
Message-ID: <20250516192803.838659-1-amir73il@gmail.com> (raw)
Jan,
Considering that the review discussion on v2 [1] did not yet converge
and considering that the merge window is very close, I realized
there is a way that we can simplify the controversial part.
There are two main use cases to allow setting marks inside user ns:
1. Christian added support for open_by_handle_at(2) to admin inside
userns, which makes watching FS_USERNS_MOUNT sb more useful.
2. The mount events added by Miklos would be very useful also inside
userns.
The rule for watching mntns inside user ns is pretty obvious and so
is the rule for watching an sb inside user ns.
The complexity discussed in review of v2 revolved around the more
complicated rules for watching fs events on a specific mount inside
users ns.
My realization is that watching fs events on a mount inside user ns
is a less intersting use case and it is much easier to apply the same
obvious rules as for watching an sb inside user ns and discuss
relaxing them later if there is any interesting use case for that.
mntns watch inside user ns was tested with the mount-notify_test_ns
selftest [2]. sb/mount watches inside user ns were tested manually
with fsnotifywatch -S and -M with some changes to inotify-tools [3].
Thanks,
Amir.
Changes since v2:
- selftest merged to Christian's tree
- Change mount mark to require capable sb user ns
- Remove incorrect reference to FS_USERNS_MOUNT in comments (Miklos)
- Avoid unneeded type casting to mntns (Miklos)
Changes since v1:
- Split cleanup patch (Jan)
- Logic simplified a bit
- Add support for mntns marks inside userns
[1] https://lore.kernel.org/linux-fsdevel/20250419100657.2654744-1-amir73il@gmail.com/
[2] https://lore.kernel.org/linux-fsdevel/20250509133240.529330-1-amir73il@gmail.com/
[3] https://github.com/amir73il/inotify-tools/commits/fanotify_userns/
Amir Goldstein (2):
fanotify: remove redundant permission checks
fanotify: support watching filesystems and mounts inside userns
fs/notify/fanotify/fanotify.c | 1 +
fs/notify/fanotify/fanotify_user.c | 50 +++++++++++++++++-------------
include/linux/fanotify.h | 5 ++-
include/linux/fsnotify_backend.h | 1 +
4 files changed, 33 insertions(+), 24 deletions(-)
--
2.34.1
next reply other threads:[~2025-05-16 19:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 19:28 Amir Goldstein [this message]
2025-05-16 19:28 ` [PATCH v3 1/2] fanotify: remove redundant permission checks Amir Goldstein
2025-05-16 19:28 ` [PATCH v3 2/2] fanotify: support watching filesystems and mounts inside userns Amir Goldstein
2025-05-19 20:56 ` [PATCH v3 0/2] User namespace aware fanotify Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250516192803.838659-1-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).