diff options
author | Eric Paris <eparis@redhat.com> | 2011-02-01 11:05:39 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2011-02-01 11:12:29 -0500 |
commit | 2a7dba391e5628ad665ce84ef9a6648da541ebab (patch) | |
tree | ba0722bd74d2c883dbda7ff721850bab411cac04 /fs/ext2/namei.c | |
parent | 821404434f3324bf23f545050ff64055a149766e (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/ext2/namei.c')
-rw-r--r-- | fs/ext2/namei.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index f8aecd2e3297..368d7049ac89 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -104,7 +104,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, st | |||
104 | 104 | ||
105 | dquot_initialize(dir); | 105 | dquot_initialize(dir); |
106 | 106 | ||
107 | inode = ext2_new_inode(dir, mode); | 107 | inode = ext2_new_inode(dir, mode, &dentry->d_name); |
108 | if (IS_ERR(inode)) | 108 | if (IS_ERR(inode)) |
109 | return PTR_ERR(inode); | 109 | return PTR_ERR(inode); |
110 | 110 | ||
@@ -133,7 +133,7 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_ | |||
133 | 133 | ||
134 | dquot_initialize(dir); | 134 | dquot_initialize(dir); |
135 | 135 | ||
136 | inode = ext2_new_inode (dir, mode); | 136 | inode = ext2_new_inode (dir, mode, &dentry->d_name); |
137 | err = PTR_ERR(inode); | 137 | err = PTR_ERR(inode); |
138 | if (!IS_ERR(inode)) { | 138 | if (!IS_ERR(inode)) { |
139 | init_special_inode(inode, inode->i_mode, rdev); | 139 | init_special_inode(inode, inode->i_mode, rdev); |
@@ -159,7 +159,7 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry, | |||
159 | 159 | ||
160 | dquot_initialize(dir); | 160 | dquot_initialize(dir); |
161 | 161 | ||
162 | inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO); | 162 | inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO, &dentry->d_name); |
163 | err = PTR_ERR(inode); | 163 | err = PTR_ERR(inode); |
164 | if (IS_ERR(inode)) | 164 | if (IS_ERR(inode)) |
165 | goto out; | 165 | goto out; |
@@ -230,7 +230,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
230 | 230 | ||
231 | inode_inc_link_count(dir); | 231 | inode_inc_link_count(dir); |
232 | 232 | ||
233 | inode = ext2_new_inode (dir, S_IFDIR | mode); | 233 | inode = ext2_new_inode(dir, S_IFDIR | mode, &dentry->d_name); |
234 | err = PTR_ERR(inode); | 234 | err = PTR_ERR(inode); |
235 | if (IS_ERR(inode)) | 235 | if (IS_ERR(inode)) |
236 | goto out_dir; | 236 | goto out_dir; |