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 /include/linux/security.h | |
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 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index c642bb8b8f5a..05dd5a64aa76 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/fsnotify.h> | 26 | #include <linux/fsnotify.h> |
27 | #include <linux/binfmts.h> | 27 | #include <linux/binfmts.h> |
28 | #include <linux/dcache.h> | ||
28 | #include <linux/signal.h> | 29 | #include <linux/signal.h> |
29 | #include <linux/resource.h> | 30 | #include <linux/resource.h> |
30 | #include <linux/sem.h> | 31 | #include <linux/sem.h> |
@@ -315,6 +316,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
315 | * then it should return -EOPNOTSUPP to skip this processing. | 316 | * then it should return -EOPNOTSUPP to skip this processing. |
316 | * @inode contains the inode structure of the newly created inode. | 317 | * @inode contains the inode structure of the newly created inode. |
317 | * @dir contains the inode structure of the parent directory. | 318 | * @dir contains the inode structure of the parent directory. |
319 | * @qstr contains the last path component of the new object | ||
318 | * @name will be set to the allocated name suffix (e.g. selinux). | 320 | * @name will be set to the allocated name suffix (e.g. selinux). |
319 | * @value will be set to the allocated attribute value. | 321 | * @value will be set to the allocated attribute value. |
320 | * @len will be set to the length of the value. | 322 | * @len will be set to the length of the value. |
@@ -1435,7 +1437,8 @@ struct security_operations { | |||
1435 | int (*inode_alloc_security) (struct inode *inode); | 1437 | int (*inode_alloc_security) (struct inode *inode); |
1436 | void (*inode_free_security) (struct inode *inode); | 1438 | void (*inode_free_security) (struct inode *inode); |
1437 | int (*inode_init_security) (struct inode *inode, struct inode *dir, | 1439 | int (*inode_init_security) (struct inode *inode, struct inode *dir, |
1438 | char **name, void **value, size_t *len); | 1440 | const struct qstr *qstr, char **name, |
1441 | void **value, size_t *len); | ||
1439 | int (*inode_create) (struct inode *dir, | 1442 | int (*inode_create) (struct inode *dir, |
1440 | struct dentry *dentry, int mode); | 1443 | struct dentry *dentry, int mode); |
1441 | int (*inode_link) (struct dentry *old_dentry, | 1444 | int (*inode_link) (struct dentry *old_dentry, |
@@ -1696,7 +1699,8 @@ int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); | |||
1696 | int security_inode_alloc(struct inode *inode); | 1699 | int security_inode_alloc(struct inode *inode); |
1697 | void security_inode_free(struct inode *inode); | 1700 | void security_inode_free(struct inode *inode); |
1698 | int security_inode_init_security(struct inode *inode, struct inode *dir, | 1701 | int security_inode_init_security(struct inode *inode, struct inode *dir, |
1699 | char **name, void **value, size_t *len); | 1702 | const struct qstr *qstr, char **name, |
1703 | void **value, size_t *len); | ||
1700 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); | 1704 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); |
1701 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, | 1705 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, |
1702 | struct dentry *new_dentry); | 1706 | struct dentry *new_dentry); |
@@ -2023,6 +2027,7 @@ static inline void security_inode_free(struct inode *inode) | |||
2023 | 2027 | ||
2024 | static inline int security_inode_init_security(struct inode *inode, | 2028 | static inline int security_inode_init_security(struct inode *inode, |
2025 | struct inode *dir, | 2029 | struct inode *dir, |
2030 | const struct qstr *qstr, | ||
2026 | char **name, | 2031 | char **name, |
2027 | void **value, | 2032 | void **value, |
2028 | size_t *len) | 2033 | size_t *len) |