Skip to content

Commit

Permalink
selftests/fs/mount-notify: add a test variant running inside userns
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amir Goldstein authored and Christian Brauner committed May 12, 2025
1 parent 8199e6f commit 781091f
Show file tree
Hide file tree
Showing 3 changed files with 560 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
/*_test
/*_test_ns
3 changes: 2 additions & 1 deletion tools/testing/selftests/filesystems/mount-notify/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
CFLAGS += -Wall -O2 -g $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
LDLIBS += -lcap

TEST_GEN_PROGS := mount-notify_test
TEST_GEN_PROGS := mount-notify_test mount-notify_test_ns

include ../../lib.mk

$(OUTPUT)/mount-notify_test: ../utils.c
$(OUTPUT)/mount-notify_test_ns: ../utils.c
Loading

0 comments on commit 781091f

Please sign in to comment.