diff options
author | Steve Grubb <sgrubb@redhat.com> | 2006-04-03 14:06:13 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-05-01 06:09:53 -0400 |
commit | 1b50eed9cac0e8e5e4d3a522d8aa267f7f8f8acb (patch) | |
tree | c66a1c3be846e34f1aac5db640b7ccb8770e8a80 /security/selinux | |
parent | 3dc7e3153eddfcf7ba8b50628775ba516e5f759f (diff) |
[PATCH] audit inode patch
Previously, we were gathering the context instead of the sid. Now in this patch,
we gather just the sid and convert to context only if an audit event is being
output.
This patch brings the performance hit from 146% down to 23%
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/exports.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/security/selinux/exports.c b/security/selinux/exports.c index 333c4c7824d8..07ddce7bf374 100644 --- a/security/selinux/exports.c +++ b/security/selinux/exports.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/selinux.h> | 16 | #include <linux/selinux.h> |
17 | #include <linux/fs.h> | ||
17 | 18 | ||
18 | #include "security.h" | 19 | #include "security.h" |
19 | #include "objsec.h" | 20 | #include "objsec.h" |
@@ -26,3 +27,26 @@ void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid) | |||
26 | else | 27 | else |
27 | *ctxid = 0; | 28 | *ctxid = 0; |
28 | } | 29 | } |
30 | |||
31 | int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen) | ||
32 | { | ||
33 | if (selinux_enabled) | ||
34 | return security_sid_to_context(ctxid, ctx, ctxlen); | ||
35 | else { | ||
36 | *ctx = NULL; | ||
37 | *ctxlen = 0; | ||
38 | } | ||
39 | |||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | void selinux_get_inode_sid(const struct inode *inode, u32 *sid) | ||
44 | { | ||
45 | if (selinux_enabled) { | ||
46 | struct inode_security_struct *isec = inode->i_security; | ||
47 | *sid = isec->sid; | ||
48 | return; | ||
49 | } | ||
50 | *sid = 0; | ||
51 | } | ||
52 | |||