fs/vfs/security: pass last path component to LSM on inode creation
authorEric Paris <eparis@redhat.com>
Tue, 1 Feb 2011 16:05:39 +0000 (11:05 -0500)
committerEric Paris <eparis@redhat.com>
Tue, 1 Feb 2011 16:12:29 +0000 (11:12 -0500)
commit2a7dba391e5628ad665ce84ef9a6648da541ebab
treeba0722bd74d2c883dbda7ff721850bab411cac04
parent821404434f3324bf23f545050ff64055a149766e
fs/vfs/security: pass last path component to LSM on inode creation

SELinux would like to implement a new labeling behavior of newly created
inodes.  We currently label new inodes based on the parent and the creating
process.  This new behavior would also take into account the name of the
new object when deciding the new label.  This is not the (supposed) full path,
just the last component of the path.

This is very useful because creating /etc/shadow is different than creating
/etc/passwd but the kernel hooks are unable to differentiate these
operations.  We currently require that userspace realize it is doing some
difficult operation like that and than userspace jumps through SELinux hoops
to get things set up correctly.  This patch does not implement new
behavior, that is obviously contained in a seperate SELinux patch, but it
does pass the needed name down to the correct LSM hook.  If no such name
exists it is fine to pass NULL.

Signed-off-by: Eric Paris <eparis@redhat.com>
39 files changed:
fs/btrfs/inode.c
fs/btrfs/xattr.c
fs/btrfs/xattr.h
fs/ext2/ext2.h
fs/ext2/ialloc.c
fs/ext2/namei.c
fs/ext2/xattr.h
fs/ext2/xattr_security.c
fs/ext3/ialloc.c
fs/ext3/namei.c
fs/ext3/xattr.h
fs/ext3/xattr_security.c
fs/ext4/ialloc.c
fs/ext4/xattr.h
fs/ext4/xattr_security.c
fs/gfs2/inode.c
fs/jffs2/dir.c
fs/jffs2/nodelist.h
fs/jffs2/security.c
fs/jffs2/write.c
fs/jffs2/xattr.h
fs/jfs/jfs_xattr.h
fs/jfs/namei.c
fs/jfs/xattr.c
fs/ocfs2/namei.c
fs/ocfs2/refcounttree.c
fs/ocfs2/xattr.c
fs/ocfs2/xattr.h
fs/reiserfs/namei.c
fs/reiserfs/xattr_security.c
fs/xfs/linux-2.6/xfs_iops.c
include/linux/ext3_fs.h
include/linux/reiserfs_xattr.h
include/linux/security.h
mm/shmem.c
security/capability.c
security/security.c
security/selinux/hooks.c
security/smack/smack_lsm.c