提交 12204e24 编写于 作者: J James Morris

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: NJames Morris <jmorris@namei.org>
Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
上级 459c19f5
...@@ -914,7 +914,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void ...@@ -914,7 +914,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
goto out_free_secdata; goto out_free_secdata;
BUG_ON(!mnt->mnt_sb); BUG_ON(!mnt->mnt_sb);
error = security_sb_kern_mount(mnt->mnt_sb, secdata); error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
if (error) if (error)
goto out_sb; goto out_sb;
......
...@@ -1308,7 +1308,7 @@ struct security_operations { ...@@ -1308,7 +1308,7 @@ struct security_operations {
int (*sb_alloc_security) (struct super_block *sb); int (*sb_alloc_security) (struct super_block *sb);
void (*sb_free_security) (struct super_block *sb); void (*sb_free_security) (struct super_block *sb);
int (*sb_copy_data) (char *orig, char *copy); int (*sb_copy_data) (char *orig, char *copy);
int (*sb_kern_mount) (struct super_block *sb, void *data); int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
int (*sb_show_options) (struct seq_file *m, struct super_block *sb); int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
int (*sb_statfs) (struct dentry *dentry); int (*sb_statfs) (struct dentry *dentry);
int (*sb_mount) (char *dev_name, struct path *path, int (*sb_mount) (char *dev_name, struct path *path,
...@@ -1575,7 +1575,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm); ...@@ -1575,7 +1575,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm);
int security_sb_alloc(struct super_block *sb); int security_sb_alloc(struct super_block *sb);
void security_sb_free(struct super_block *sb); void security_sb_free(struct super_block *sb);
int security_sb_copy_data(char *orig, char *copy); int security_sb_copy_data(char *orig, char *copy);
int security_sb_kern_mount(struct super_block *sb, void *data); int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
int security_sb_show_options(struct seq_file *m, struct super_block *sb); int security_sb_show_options(struct seq_file *m, struct super_block *sb);
int security_sb_statfs(struct dentry *dentry); int security_sb_statfs(struct dentry *dentry);
int security_sb_mount(char *dev_name, struct path *path, 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,7 +1850,7 @@ static inline int security_sb_copy_data(char *orig, char *copy)
return 0; return 0;
} }
static inline int security_sb_kern_mount(struct super_block *sb, void *data) static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
{ {
return 0; return 0;
} }
......
...@@ -59,7 +59,7 @@ static int cap_sb_copy_data(char *orig, char *copy) ...@@ -59,7 +59,7 @@ static int cap_sb_copy_data(char *orig, char *copy)
return 0; return 0;
} }
static int cap_sb_kern_mount(struct super_block *sb, void *data) static int cap_sb_kern_mount(struct super_block *sb, int flags, void *data)
{ {
return 0; return 0;
} }
......
...@@ -254,9 +254,9 @@ int security_sb_copy_data(char *orig, char *copy) ...@@ -254,9 +254,9 @@ int security_sb_copy_data(char *orig, char *copy)
} }
EXPORT_SYMBOL(security_sb_copy_data); EXPORT_SYMBOL(security_sb_copy_data);
int security_sb_kern_mount(struct super_block *sb, void *data) int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
{ {
return security_ops->sb_kern_mount(sb, data); return security_ops->sb_kern_mount(sb, flags, data);
} }
int security_sb_show_options(struct seq_file *m, struct super_block *sb) int security_sb_show_options(struct seq_file *m, struct super_block *sb)
......
...@@ -2474,7 +2474,7 @@ static int selinux_sb_copy_data(char *orig, char *copy) ...@@ -2474,7 +2474,7 @@ static int selinux_sb_copy_data(char *orig, char *copy)
return rc; return rc;
} }
static int selinux_sb_kern_mount(struct super_block *sb, void *data) static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data)
{ {
const struct cred *cred = current_cred(); const struct cred *cred = current_cred();
struct avc_audit_data ad; struct avc_audit_data ad;
......
...@@ -250,11 +250,12 @@ static int smack_sb_copy_data(char *orig, char *smackopts) ...@@ -250,11 +250,12 @@ static int smack_sb_copy_data(char *orig, char *smackopts)
/** /**
* smack_sb_kern_mount - Smack specific mount processing * smack_sb_kern_mount - Smack specific mount processing
* @sb: the file system superblock * @sb: the file system superblock
* @flags: the mount flags
* @data: the smack mount options * @data: the smack mount options
* *
* Returns 0 on success, an error code on failure * Returns 0 on success, an error code on failure
*/ */
static int smack_sb_kern_mount(struct super_block *sb, void *data) static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data)
{ {
struct dentry *root = sb->s_root; struct dentry *root = sb->s_root;
struct inode *inode = root->d_inode; struct inode *inode = root->d_inode;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册