Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 235111
b: refs/heads/master
c: ff36fe2
h: refs/heads/master
i:
  235109: cd8c257
  235107: f0e05c2
  235103: 9382e70
v: v3
  • Loading branch information
Eric Paris committed Mar 3, 2011
1 parent 731b8e9 commit 78d2ef4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ad18bdf3b8f84c85c7da7e4de365f7c5701fb3f
refs/heads/master: ff36fe2c845cab2102e4826c1ffa0a6ebf487c65
4 changes: 4 additions & 0 deletions trunk/fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,10 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
if (path->dentry != path->mnt->mnt_root)
return -EINVAL;

err = security_sb_remount(sb, data);
if (err)
return err;

down_write(&sb->s_umount);
if (flags & MS_BIND)
err = change_mount_flags(path->mnt, flags);
Expand Down
13 changes: 13 additions & 0 deletions trunk/include/linux/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
* @orig the original mount data copied from userspace.
* @copy copied data which will be passed to the security module.
* Returns 0 if the copy was successful.
* @sb_remount:
* Extracts security system specifc mount options and verifys no changes
* are being made to those options.
* @sb superblock being remounted
* @data contains the filesystem-specific data.
* Return 0 if permission is granted.
* @sb_umount:
* Check permission before the @mnt file system is unmounted.
* @mnt contains the mounted file system.
Expand Down Expand Up @@ -1394,6 +1400,7 @@ struct security_operations {
int (*sb_alloc_security) (struct super_block *sb);
void (*sb_free_security) (struct super_block *sb);
int (*sb_copy_data) (char *orig, char *copy);
int (*sb_remount) (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_statfs) (struct dentry *dentry);
Expand Down Expand Up @@ -1676,6 +1683,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm);
int security_sb_alloc(struct super_block *sb);
void security_sb_free(struct super_block *sb);
int security_sb_copy_data(char *orig, char *copy);
int security_sb_remount(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_statfs(struct dentry *dentry);
Expand Down Expand Up @@ -1955,6 +1963,11 @@ static inline int security_sb_copy_data(char *orig, char *copy)
return 0;
}

static inline int security_sb_remount(struct super_block *sb, void *data)
{
return 0;
}

static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
{
return 0;
Expand Down
6 changes: 6 additions & 0 deletions trunk/security/capability.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ static int cap_sb_copy_data(char *orig, char *copy)
return 0;
}

static int cap_sb_remount(struct super_block *sb, void *data)
{
return 0;
}

static int cap_sb_kern_mount(struct super_block *sb, int flags, void *data)
{
return 0;
Expand Down Expand Up @@ -887,6 +892,7 @@ void __init security_fixup_ops(struct security_operations *ops)
set_to_cap_if_null(ops, sb_alloc_security);
set_to_cap_if_null(ops, sb_free_security);
set_to_cap_if_null(ops, sb_copy_data);
set_to_cap_if_null(ops, sb_remount);
set_to_cap_if_null(ops, sb_kern_mount);
set_to_cap_if_null(ops, sb_show_options);
set_to_cap_if_null(ops, sb_statfs);
Expand Down
5 changes: 5 additions & 0 deletions trunk/security/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ int security_sb_copy_data(char *orig, char *copy)
}
EXPORT_SYMBOL(security_sb_copy_data);

int security_sb_remount(struct super_block *sb, void *data)
{
return security_ops->sb_remount(sb, data);
}

int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
{
return security_ops->sb_kern_mount(sb, flags, data);
Expand Down

0 comments on commit 78d2ef4

Please sign in to comment.