Skip to content

Commit 7d90fb5

Browse files
Miklos Szeredibrauner
authored andcommitted
selinux: add FILE__WATCH_MOUNTNS
Watching mount namespaces for changes (mount, umount, move mount) was added by previous patches. This patch adds the file/watch_mountns permission that can be applied to nsfs files (/proc/$$/ns/mnt), making it possible to allow or deny watching a particular namespace for changes. Suggested-by: Paul Moore <paul@paul-moore.com> Link: https://lore.kernel.org/all/CAHC9VhTOmCjCSE2H0zwPOmpFopheexVb6jyovz92ZtpKtoVv6A@mail.gmail.com/ Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Link: https://lore.kernel.org/r/20250224154836.958915-1-mszeredi@redhat.com Acked-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 33cec19 commit 7d90fb5

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

security/selinux/hooks.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3395,6 +3395,9 @@ static int selinux_path_notify(const struct path *path, u64 mask,
33953395
case FSNOTIFY_OBJ_TYPE_INODE:
33963396
perm = FILE__WATCH;
33973397
break;
3398+
case FSNOTIFY_OBJ_TYPE_MNTNS:
3399+
perm = FILE__WATCH_MOUNTNS;
3400+
break;
33983401
default:
33993402
return -EINVAL;
34003403
}

security/selinux/include/classmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
COMMON_FILE_SOCK_PERMS, "unlink", "link", "rename", "execute", \
99
"quotaon", "mounton", "audit_access", "open", "execmod", \
1010
"watch", "watch_mount", "watch_sb", "watch_with_perm", \
11-
"watch_reads"
11+
"watch_reads", "watch_mountns"
1212

1313
#define COMMON_SOCK_PERMS \
1414
COMMON_FILE_SOCK_PERMS, "bind", "connect", "listen", "accept", \

0 commit comments

Comments
 (0)