selftests/fs/mount-notify: add a test variant running inside userns
authorAmir Goldstein <amir73il@gmail.com>
Fri, 9 May 2025 13:32:40 +0000 (15:32 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 12 May 2025 09:40:13 +0000 (11:40 +0200)
commit781091f3f59456e881170570b2304ec11e9ce7e0
tree7f2633154416d18b47949b790d9f2f0247726c70
parent8199e6f7402ca2232de6f57b918d2b1fb9c224cb
selftests/fs/mount-notify: add a test variant running inside userns

unshare userns in addition to mntns and verify that:

1. watching tmpfs mounted inside userns is allowed with any mark type
2. watching orig root with filesystem mark type is not allowed
3. watching mntns of orig userns is not allowed
4. watching mntns in userns where fanotify_init was called is allowed

mount events are only tested with the last case of mntns mark.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/20250509133240.529330-9-amir73il@gmail.com
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
tools/testing/selftests/filesystems/mount-notify/.gitignore
tools/testing/selftests/filesystems/mount-notify/Makefile
tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c [new file with mode: 0644]