Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1636292
| From | Sebastien Buisson <sbuisson.ddn@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/2] selinux: expose policy brief via selinuxfs |
| Date | 2017-05-05 12:20 +0200 |
| Message-ID | <tDIv8-kZ-13@gated-at.bofh.it> (permalink) |
| References | <tDIv8-kZ-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Expose policy brief via selinuxfs.
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
---
security/selinux/selinuxfs.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index b959ee7..8782b79 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -101,6 +101,7 @@ enum sel_inos {
SEL_STATUS, /* export current status using mmap() */
SEL_POLICY, /* allow userspace to read the in kernel policy */
SEL_VALIDATE_TRANS, /* compute validatetrans decision */
+ SEL_POLICYBRIEF,/* return policy summary */
SEL_INO_NEXT, /* The next inode number to use */
};
@@ -316,6 +317,29 @@ static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
.llseek = generic_file_llseek,
};
+static ssize_t sel_read_policybrief(struct file *filp, char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ char *tmpbuf;
+ size_t len;
+ ssize_t rc;
+
+ rc = security_policydb_brief(&tmpbuf, &len, true);
+ if (rc)
+ return rc;
+
+ rc = simple_read_from_buffer(buf, count, ppos, tmpbuf, len);
+
+ kfree(tmpbuf);
+
+ return rc;
+}
+
+static const struct file_operations sel_policybrief_ops = {
+ .read = sel_read_policybrief,
+ .llseek = generic_file_llseek,
+};
+
/* declaration for sel_write_load */
static int sel_make_bools(void);
static int sel_make_classes(void);
@@ -1829,6 +1853,8 @@ static int sel_fill_super(struct super_block *sb, void *data, int silent)
[SEL_POLICY] = {"policy", &sel_policy_ops, S_IRUGO},
[SEL_VALIDATE_TRANS] = {"validatetrans", &sel_transition_ops,
S_IWUGO},
+ [SEL_POLICYBRIEF] = {"policybrief", &sel_policybrief_ops,
+ S_IRUGO},
/* last one */ {""}
};
ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files);
--
1.8.3.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 1/2] selinux: add brief info to policydb Sebastien Buisson <sbuisson.ddn@gmail.com> - 2017-05-05 12:20 +0200
[PATCH v2 2/2] selinux: expose policy brief via selinuxfs Sebastien Buisson <sbuisson.ddn@gmail.com> - 2017-05-05 12:20 +0200
Re: [PATCH v2 1/2] selinux: add brief info to policydb Casey Schaufler <casey@schaufler-ca.com> - 2017-05-05 20:40 +0200
Re: [PATCH v2 1/2] selinux: add brief info to policydb Sebastien Buisson <sbuisson.ddn@gmail.com> - 2017-05-11 15:10 +0200
Re: [PATCH v2 1/2] selinux: add brief info to policydb Stephen Smalley <sds@tycho.nsa.gov> - 2017-05-05 21:40 +0200
csiph-web