Message ID | 20250224154836.958915-1-mszeredi@redhat.com (mailing list archive) |
---|---|
State | Under Review |
Delegated to: | Paul Moore |
Headers | show |
Series | selinux: add FILE__WATCH_MOUNTNS | expand |
On Feb 24, 2025 Miklos Szeredi <mszeredi@redhat.com> wrote: > > 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> > --- > security/selinux/hooks.c | 3 +++ > security/selinux/include/classmap.h | 2 +- > 2 files changed, 4 insertions(+), 1 deletion(-) Thanks Miklos, this looks good to me. VFS folks / Christian, can you merge this into the associated FSNOTIFY_OBJ_TYPE_MNTNS branch you are targeting for linux-next? Acked-by: Paul Moore <paul@paul-moore.com> -- paul-moore.com
On Mon, 24 Feb 2025 16:48:36 +0100, Miklos Szeredi wrote: > 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. > > [...] Applied to the vfs-6.15.mount branch of the vfs/vfs.git tree. Patches in the vfs-6.15.mount branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-6.15.mount [1/1] selinux: add FILE__WATCH_MOUNTNS https://git.kernel.org/vfs/vfs/c/7d90fb525319
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 7b867dfec88b..212cdead2b52 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -3395,6 +3395,9 @@ static int selinux_path_notify(const struct path *path, u64 mask, case FSNOTIFY_OBJ_TYPE_INODE: perm = FILE__WATCH; break; + case FSNOTIFY_OBJ_TYPE_MNTNS: + perm = FILE__WATCH_MOUNTNS; + break; default: return -EINVAL; } diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h index 03e82477dce9..f9b5ca92a825 100644 --- a/security/selinux/include/classmap.h +++ b/security/selinux/include/classmap.h @@ -8,7 +8,7 @@ COMMON_FILE_SOCK_PERMS, "unlink", "link", "rename", "execute", \ "quotaon", "mounton", "audit_access", "open", "execmod", \ "watch", "watch_mount", "watch_sb", "watch_with_perm", \ - "watch_reads" + "watch_reads", "watch_mountns" #define COMMON_SOCK_PERMS \ COMMON_FILE_SOCK_PERMS, "bind", "connect", "listen", "accept", \
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> --- security/selinux/hooks.c | 3 +++ security/selinux/include/classmap.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)