aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
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/gfs2
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/gfs2')
-rw-r--r--fs/gfs2/inode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 2232b3c780bd..de35ca7d7980 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -791,14 +791,15 @@ fail:
791 return error; 791 return error;
792} 792}
793 793
794static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip) 794static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip,
795 const struct qstr *qstr)
795{ 796{
796 int err; 797 int err;
797 size_t len; 798 size_t len;
798 void *value; 799 void *value;
799 char *name; 800 char *name;
800 801
801 err = security_inode_init_security(&ip->i_inode, &dip->i_inode, 802 err = security_inode_init_security(&ip->i_inode, &dip->i_inode, qstr,
802 &name, &value, &len); 803 &name, &value, &len);
803 804
804 if (err) { 805 if (err) {
@@ -882,7 +883,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
882 if (error) 883 if (error)
883 goto fail_gunlock2; 884 goto fail_gunlock2;
884 885
885 error = gfs2_security_init(dip, GFS2_I(inode)); 886 error = gfs2_security_init(dip, GFS2_I(inode), name);
886 if (error) 887 if (error)
887 goto fail_gunlock2; 888 goto fail_gunlock2;
888 889