Skip to content

RFC Patches to pass vfsmount to LSM inode security hooks

Tony Jones linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest28 patches 32 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/28Pass struct vfsmount to the inode_create LSM hook.fs/namei.c include/linux/security.h security/dummy.c +1 more+10 -60 replies
2/28Remove redundant check from proc_setattr().fs/proc/base.c+2 -51 reply
3/28Pass struct file down to remove_suid and childrenfs/ntfs/file.c fs/ocfs2/file.c fs/reiserfs/file.c +6 more+24 -240 replies
4/28Add a vfsmount parameter to notify_change()fs/attr.c fs/ecryptfs/inode.c fs/exec.c +11 more+39 -320 replies
5/28Pass struct vfsmount to the inode_setattr LSM hookfs/attr.c include/linux/security.h security/dummy.c +1 more+13 -70 replies
6/28Add struct vfsmount parameter to vfs_mkdir()fs/ecryptfs/inode.c fs/namei.c fs/nfsd/nfs4recover.c +2 more+10 -60 replies
7/28Pass struct vfsmount to the inode_mkdir LSM hookfs/namei.c include/linux/security.h security/dummy.c +1 more+10 -50 replies
8/28Add a struct vfsmount parameter to vfs_mknod()fs/ecryptfs/inode.c fs/namei.c fs/nfsd/vfs.c +2 more+13 -80 replies
9/28Pass struct vfsmount to the inode_mknod LSM hookfs/namei.c include/linux/security.h security/dummy.c +1 more+10 -60 replies
10/28Add a struct vfsmount parameter to vfs_symlink()fs/ecryptfs/inode.c fs/namei.c fs/nfsd/vfs.c +1 more+11 -60 replies
11/28Pass struct vfsmount to the inode_symlink LSM hook.fs/namei.c include/linux/security.h security/dummy.c +1 more+10 -60 replies
12/28Pass struct vfsmount to the inode_readlink LSM hookfs/stat.c include/linux/security.h security/dummy.c +1 more+10 -70 replies
13/28Add struct vfsmount parameters to vfs_link()fs/ecryptfs/inode.c fs/namei.c fs/nfsd/vfs.c +1 more+12 -60 replies
14/28Pass struct vfsmount to the inode_link LSM hookfs/namei.c include/linux/security.h security/dummy.c +1 more+26 -100 replies
15/28Add a struct vfsmount parameter to vfs_rmdir()fs/ecryptfs/inode.c fs/namei.c fs/nfsd/nfs4recover.c +3 more+9 -70 replies
16/28Pass struct vfsmount to the inode_rmdir LSM hookfs/namei.c include/linux/security.h security/dummy.c +1 more+13 -70 replies
17/28Add a struct vfsmount parameter to vfs_unlink()fs/ecryptfs/inode.c fs/namei.c fs/nfsd/nfs4recover.c +3 more+8 -70 replies
18/28Pass struct vfsmount to the inode_unlink LSM hookfs/namei.c include/linux/security.h security/dummy.c +1 more+14 -80 replies
19/28Add struct vfsmount parameters to vfs_rename()fs/ecryptfs/inode.c fs/namei.c fs/nfsd/vfs.c +1 more+20 -100 replies
20/28Pass struct vfsmount to the inode_rename LSM hookfs/namei.c include/linux/security.h security/dummy.c +1 more+26 -100 replies
21/28Add a struct vfsmount parameter to vfs_setxattr()fs/nfsd/vfs.c fs/xattr.c include/linux/xattr.h+12 -110 replies
22/28Pass struct vfsmount to the inode_setxattr LSM hookfs/xattr.c include/linux/security.h security/commoncap.c +2 more+41 -240 replies
23/28Add a struct vfsmount parameter to vfs_getxattr()fs/nfsd/vfs.c fs/xattr.c include/linux/xattr.h+12 -90 replies
24/28Pass struct vfsmount to the inode_getxattr LSM hookfs/xattr.c include/linux/security.h security/dummy.c +1 more+13 -80 replies
25/28Add a struct vfsmount parameter to vfs_listxattr()fs/xattr.c include/linux/xattr.h+16 -120 replies
26/28Pass struct vfsmount to the inode_listxattr LSM hookfs/xattr.c include/linux/security.h security/dummy.c +1 more+10 -80 replies
27/28Add a struct vfsmount parameter to vfs_removexattr()fs/nfsd/vfs.c fs/xattr.c include/linux/xattr.h+8 -80 replies
28/28Pass struct vfsmount to the inode_removexattr LSM hookfs/xattr.c include/linux/security.h security/commoncap.c +2 more+16 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/28] Patches to pass vfsmount to LSM inode security hooks

Introduction
------------

The following are a set of patches the goal of which is to pass vfsmounts through select portions of the VFS layer sufficient to be visible to the LSM inode operation hooks.

They are being posted now as a request for comment. Presently the AppArmor code - being a user of the LSM interface - does not receive the vfsmount correspoding to an operation and has to employ convoluted and slow mechanisms in an attempt to determine the vfsmount which are error prone. Therefore these patches or some variant of them are viewed as a necessary precursor for the AppArmor code being resubmitted.

It is currently planned to resubmit the AppArmor code to the list in the next month. We apologise greatly for the silence since the last submission, a combination of research into different designs, other work pressures and just not doing the "right thing". Regardless, early discussion and feedback on the interface changes presented here is appreciated.

Limitations of the current patches
----------------------------------

NULL is passed for the vfsmount from all NFS functions, this is analagous to the current NULL nameidata for security_inode_permission. NULL is also passed in certain cases for internal filesystem data which is not visible in the normal namespace (Reiserfs being one example).

Struct vfsmount is passed to the LSM inode hooks rather than struct nameidata as the hooks do not require the intent data and also as a few hooks are called when only a struct file is available.

Possible changes
----------------

A second parameter is now being passed to many functions. One alternative is to ammend the LSM interface (and struct nameidata) to use struct path instead but this would be a larger change.

Patches
-------

security-create.diff
Pass struct vfsmount to the inode_create LSM hook.

proc_setattr.diff
Remove redundant check from proc_setattr().

remove_suid.diff
Pass struct file down to remove_suid and children

vfs-notify_change.diff
Add a vfsmount parameter to notify_change()

security-setattr.diff
Pass struct vfsmount to the inode_setattr LSM hook

vfs-mkdir.diff
Add struct vfsmount parameter to vfs_mkdir()

security-mkdir.diff
Pass struct vfsmount to the inode_mkdir LSM hook

vfs-mknod.diff
Add a struct vfsmount parameter to vfs_mknod()

security-mknod.diff
Pass struct vfsmount to the inode_mknod LSM hook

vfs-symlink.diff
Add a struct vfsmount parameter to vfs_symlink()

security-symlink.diff
Pass struct vfsmount to the inode_symlink LSM hook.

security-readlink.diff
Pass struct vfsmount to the inode_readlink LSM hook

vfs-link.diff
Add struct vfsmount parameters to vfs_link()

security-link.diff
Pass struct vfsmount to the inode_link LSM hook

vfs-rmdir.diff
Add a struct vfsmount parameter to vfs_rmdir()

security-rmdir.diff
Pass struct vfsmount to the inode_rmdir LSM hook

vfs-unlink.diff
Add a struct vfsmount parameter to vfs_unlink()

security-unlink.diff
Pass struct vfsmount to the inode_unlink LSM hook

vfs-rename.diff
Add struct vfsmount parameters to vfs_rename()

security-rename.diff
Pass struct vfsmount to the inode_rename LSM hook

vfs-setxattr.diff
Add a struct vfsmount parameter to vfs_setxattr()

security-setxattr.diff
Pass struct vfsmount to the inode_setxattr LSM hook

vfs-getxattr.diff
Add a struct vfsmount parameter to vfs_getxattr()

security-getxattr.diff
Pass struct vfsmount to the inode_getxattr LSM hook

vfs-listxattr.diff
Add a struct vfsmount parameter to vfs_listxattr()

security-listxattr.diff
Pass struct vfsmount to the inode_listxattr LSM hook

vfs-removexattr.diff
Add a struct vfsmount parameter to vfs_removexattr()

security-removexattr.diff
Pass struct vfsmount to the inode_removexattr LSM hook