diff options
author | James Morris <jmorris@namei.org> | 2008-12-18 18:44:42 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-12-19 17:02:39 -0500 |
commit | 12204e24b1330428c3062faee10a0d80b8a5cb61 (patch) | |
tree | d92ee705a86f0ec2bf85c8a797239dbb840d5927 | |
parent | 459c19f524a9d89c65717a7d061d5f11ecf6bcb8 (diff) |
security: pass mount flags to security_sb_kern_mount()
Pass mount flags to security_sb_kern_mount(), so security modules
can determine if a mount operation is being performed by the kernel.
Signed-off-by: James Morris <jmorris@namei.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
-rw-r--r-- | fs/super.c | 2 | ||||
-rw-r--r-- | include/linux/security.h | 6 | ||||
-rw-r--r-- | security/capability.c | 2 | ||||
-rw-r--r-- | security/security.c | 4 | ||||
-rw-r--r-- | security/selinux/hooks.c | 2 | ||||
-rw-r--r-- | security/smack/smack_lsm.c | 3 |
6 files changed, 10 insertions, 9 deletions
diff --git a/fs/super.c b/fs/super.c index 400a7608f15e..ddba069d7a99 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -914,7 +914,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void | |||
914 | goto out_free_secdata; | 914 | goto out_free_secdata; |
915 | BUG_ON(!mnt->mnt_sb); | 915 | BUG_ON(!mnt->mnt_sb); |
916 | 916 | ||
917 | error = security_sb_kern_mount(mnt->mnt_sb, secdata); | 917 | error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); |
918 | if (error) | 918 | if (error) |
919 | goto out_sb; | 919 | goto out_sb; |
920 | 920 | ||
diff --git a/include/linux/security.h b/include/linux/security.h index 6423abf1ac0f..3416cb85e77b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1308,7 +1308,7 @@ struct security_operations { | |||
1308 | int (*sb_alloc_security) (struct super_block *sb); | 1308 | int (*sb_alloc_security) (struct super_block *sb); |
1309 | void (*sb_free_security) (struct super_block *sb); | 1309 | void (*sb_free_security) (struct super_block *sb); |
1310 | int (*sb_copy_data) (char *orig, char *copy); | 1310 | int (*sb_copy_data) (char *orig, char *copy); |
1311 | int (*sb_kern_mount) (struct super_block *sb, void *data); | 1311 | int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); |
1312 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); | 1312 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); |
1313 | int (*sb_statfs) (struct dentry *dentry); | 1313 | int (*sb_statfs) (struct dentry *dentry); |
1314 | int (*sb_mount) (char *dev_name, struct path *path, | 1314 | int (*sb_mount) (char *dev_name, struct path *path, |
@@ -1575,7 +1575,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm); | |||
1575 | int security_sb_alloc(struct super_block *sb); | 1575 | int security_sb_alloc(struct super_block *sb); |
1576 | void security_sb_free(struct super_block *sb); | 1576 | void security_sb_free(struct super_block *sb); |
1577 | int security_sb_copy_data(char *orig, char *copy); | 1577 | int security_sb_copy_data(char *orig, char *copy); |
1578 | int security_sb_kern_mount(struct super_block *sb, void *data); | 1578 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data); |
1579 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); | 1579 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); |
1580 | int security_sb_statfs(struct dentry *dentry); | 1580 | int security_sb_statfs(struct dentry *dentry); |
1581 | int security_sb_mount(char *dev_name, struct path *path, | 1581 | int security_sb_mount(char *dev_name, struct path *path, |
@@ -1850,7 +1850,7 @@ static inline int security_sb_copy_data(char *orig, char *copy) | |||
1850 | return 0; | 1850 | return 0; |
1851 | } | 1851 | } |
1852 | 1852 | ||
1853 | static inline int security_sb_kern_mount(struct super_block *sb, void *data) | 1853 | static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data) |
1854 | { | 1854 | { |
1855 | return 0; | 1855 | return 0; |
1856 | } | 1856 | } |
diff --git a/security/capability.c b/security/capability.c index b9e391425e6f..2dce66fcb992 100644 --- a/security/capability.c +++ b/security/capability.c | |||
@@ -59,7 +59,7 @@ static int cap_sb_copy_data(char *orig, char *copy) | |||
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | static int cap_sb_kern_mount(struct super_block *sb, void *data) | 62 | static int cap_sb_kern_mount(struct super_block *sb, int flags, void *data) |
63 | { | 63 | { |
64 | return 0; | 64 | return 0; |
65 | } | 65 | } |
diff --git a/security/security.c b/security/security.c index f0d96a6cc4e9..d85dbb37c972 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -254,9 +254,9 @@ int security_sb_copy_data(char *orig, char *copy) | |||
254 | } | 254 | } |
255 | EXPORT_SYMBOL(security_sb_copy_data); | 255 | EXPORT_SYMBOL(security_sb_copy_data); |
256 | 256 | ||
257 | int security_sb_kern_mount(struct super_block *sb, void *data) | 257 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data) |
258 | { | 258 | { |
259 | return security_ops->sb_kern_mount(sb, data); | 259 | return security_ops->sb_kern_mount(sb, flags, data); |
260 | } | 260 | } |
261 | 261 | ||
262 | int security_sb_show_options(struct seq_file *m, struct super_block *sb) | 262 | int security_sb_show_options(struct seq_file *m, struct super_block *sb) |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 8dbc54cde59e..7465d713b531 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2474,7 +2474,7 @@ out: | |||
2474 | return rc; | 2474 | return rc; |
2475 | } | 2475 | } |
2476 | 2476 | ||
2477 | static int selinux_sb_kern_mount(struct super_block *sb, void *data) | 2477 | static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) |
2478 | { | 2478 | { |
2479 | const struct cred *cred = current_cred(); | 2479 | const struct cred *cred = current_cred(); |
2480 | struct avc_audit_data ad; | 2480 | struct avc_audit_data ad; |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 8ad48161cef5..1b5551dfc1f7 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -250,11 +250,12 @@ static int smack_sb_copy_data(char *orig, char *smackopts) | |||
250 | /** | 250 | /** |
251 | * smack_sb_kern_mount - Smack specific mount processing | 251 | * smack_sb_kern_mount - Smack specific mount processing |
252 | * @sb: the file system superblock | 252 | * @sb: the file system superblock |
253 | * @flags: the mount flags | ||
253 | * @data: the smack mount options | 254 | * @data: the smack mount options |
254 | * | 255 | * |
255 | * Returns 0 on success, an error code on failure | 256 | * Returns 0 on success, an error code on failure |
256 | */ | 257 | */ |
257 | static int smack_sb_kern_mount(struct super_block *sb, void *data) | 258 | static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) |
258 | { | 259 | { |
259 | struct dentry *root = sb->s_root; | 260 | struct dentry *root = sb->s_root; |
260 | struct inode *inode = root->d_inode; | 261 | struct inode *inode = root->d_inode; |