LSM/SELinux: show LSM mount options in /proc/mounts
Subsystems (3)
PATCH 1/1 LSM/SELinux: show LSM mount options in /proc/mounts
This patch causes SELinux mount options to show up in /proc/mounts. As with other code in the area seq_put errors are ignored. Other LSM's will not have their mount options displayed until they fill in their own security_sb_show_options() function.
---
fs/namespace.c | 3 +- include/linux/security.h | 9 +++++++ security/dummy.c | 6 +++++ security/security.c | 5 ++++ security/selinux/hooks.c | 55 +++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 76 insertions(+), 2 deletions(-)
fs/namespace.c +2 -1
@@ -716,7 +716,8 @@ static int show_vfsmnt(struct seq_file *m, void *v)if (mnt->mnt_flags & fs_infop->flag)seq_puts (m, fs_infop->str); } -if (mnt->mnt_sb->s_op->show_options) + err =security_sb_show_options (m, mnt->mnt_sb); +if (!err && mnt->mnt_sb->s_op->show_options) err = mnt->mnt_sb->s_op->show_options (m, mnt);seq_puts (m," 0 0\n" );return err;
include/linux/security.h +9 -0
@@ -78,6 +78,7 @@ struct xfrm_selector;struct xfrm_policy ;struct xfrm_state ;struct xfrm_user_sec_ctx ; +struct seq_file ;extern int cap_netlink_send (struct sock *sk,struct sk_buff *skb);extern int cap_netlink_recv (struct sk_buff *skb,int cap);
@@ -1314,6 +1315,7 @@ struct security_operations {void (*sb_free_security) (struct super_block * sb);int (*sb_copy_data)(char *orig,char *copy);int (*sb_kern_mount) (struct super_block *sb,void *data); +int (*sb_show_options) (struct seq_file *m,struct super_block *sb);int (*sb_statfs) (struct dentry *dentry);int (*sb_mount) (char *dev_name,struct path *path,char *type,unsigned long flags,void *data);
@@ -1592,6 +1594,7 @@ 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_kern_mount (struct super_block *sb,void *data); +int security_sb_show_options (struct seq_file *m,struct super_block *sb);int security_sb_statfs (struct dentry *dentry);int security_sb_mount (char *dev_name,struct path *path,char *type,unsigned long flags,void *data);
@@ -1867,6 +1870,12 @@ static inline int security_sb_kern_mount (struct super_block *sb, void *data)return 0 ; } +static inline int security_sb_show_options (struct seq_file *m, +struct super_block *sb) +{ +return 0 ; +} +static inline int security_sb_statfs (struct dentry *dentry) {return 0 ;
security/dummy.c +6 -0
@@ -191,6 +191,11 @@ static int dummy_sb_kern_mount (struct super_block *sb, void *data)return 0 ; } +static int dummy_sb_show_options (struct seq_file *m,struct super_block *sb) +{ +return 0 ; +} +static int dummy_sb_statfs (struct dentry *dentry) {return 0 ;
@@ -1057,6 +1062,7 @@ void security_fixup_ops (struct security_operations *ops)set_to_dummy_if_null (ops, sb_free_security);set_to_dummy_if_null (ops, sb_copy_data);set_to_dummy_if_null (ops, sb_kern_mount); +set_to_dummy_if_null (ops, sb_show_options);set_to_dummy_if_null (ops, sb_statfs);set_to_dummy_if_null (ops, sb_mount);set_to_dummy_if_null (ops, sb_check_sb);
security/security.c +5 -0
@@ -291,6 +291,11 @@ int security_sb_kern_mount(struct super_block *sb, void *data)return security_ops->sb_kern_mount (sb, data); } +int security_sb_show_options (struct seq_file *m,struct super_block *sb) +{ +return security_ops->sb_show_options (m, sb); +} +int security_sb_statfs (struct dentry *dentry) {return security_ops->sb_statfs (dentry);
security/selinux/hooks.c +54 -1
73 lines not on this page · raw message
James Morris
maintainerQuoted 7 lines · Eric Paris
This patch causes SELinux mount options to show up in
/proc/mounts. As with other code in the areaseq_puterrors are ignored. Other LSM's will not have their mount options displayed until they fill in their ownsecurity_sb_show_options()function.Signed-off-by Eric Paris <[email protected]>
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-linus
Signature · 2 lines
James Morris <[email protected]>
James Morris
maintainerQuoted 7 lines · James Morris
Quoted 5 lines · Eric Paris
This patch causes SELinux mount options to show up in
/proc/mounts. As with other code in the areaseq_puterrors are ignored. Other LSM's will not have their mount options displayed until they fill in their ownsecurity_sb_show_options()function.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Eric Paris <[email protected]>Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-linus
I had to drop it again as it does not apply to Linus' tree now, and it's not an obvious and trivial fix.
Signature · 7 lines
James Morris <[email protected]> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
James Morris
maintainerQuoted 9 lines · James Morris
Quoted 7 lines · James Morris
Quoted 5 lines · Eric Paris
This patch causes SELinux mount options to show up in
/proc/mounts. As with other code in the areaseq_puterrors are ignored. Other LSM's will not have their mount options displayed until they fill in their ownsecurity_sb_show_options()function.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Eric Paris <[email protected]>Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-linusI had to drop it again as it does not apply to Linus' tree now, and it's not an obvious and trivial fix.
Also, you need an ack from a VFS person on this.
Signature · 7 lines
James Morris <[email protected]> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.