aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2011-02-01 11:05:39 -0500
committerEric Paris <eparis@redhat.com>2011-02-01 11:12:29 -0500
commit2a7dba391e5628ad665ce84ef9a6648da541ebab (patch)
treeba0722bd74d2c883dbda7ff721850bab411cac04 /fs/xfs
parent821404434f3324bf23f545050ff64055a149766e (diff)
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 94d5fd6a2973..d9298cf60266 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -103,7 +103,8 @@ xfs_mark_inode_dirty(
103STATIC int 103STATIC int
104xfs_init_security( 104xfs_init_security(
105 struct inode *inode, 105 struct inode *inode,
106 struct inode *dir) 106 struct inode *dir,
107 const struct qstr *qstr)
107{ 108{
108 struct xfs_inode *ip = XFS_I(inode); 109 struct xfs_inode *ip = XFS_I(inode);
109 size_t length; 110 size_t length;
@@ -111,7 +112,7 @@ xfs_init_security(
111 unsigned char *name; 112 unsigned char *name;
112 int error; 113 int error;
113 114
114 error = security_inode_init_security(inode, dir, (char **)&name, 115 error = security_inode_init_security(inode, dir, qstr, (char **)&name,
115 &value, &length); 116 &value, &length);
116 if (error) { 117 if (error) {
117 if (error == -EOPNOTSUPP) 118 if (error == -EOPNOTSUPP)
@@ -195,7 +196,7 @@ xfs_vn_mknod(
195 196
196 inode = VFS_I(ip); 197 inode = VFS_I(ip);
197 198
198 error = xfs_init_security(inode, dir); 199 error = xfs_init_security(inode, dir, &dentry->d_name);
199 if (unlikely(error)) 200 if (unlikely(error))
200 goto out_cleanup_inode; 201 goto out_cleanup_inode;
201 202
@@ -368,7 +369,7 @@ xfs_vn_symlink(
368 369
369 inode = VFS_I(cip); 370 inode = VFS_I(cip);
370 371
371 error = xfs_init_security(inode, dir); 372 error = xfs_init_security(inode, dir, &dentry->d_name);
372 if (unlikely(error)) 373 if (unlikely(error))
373 goto out_cleanup_inode; 374 goto out_cleanup_inode;
374 375