aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack/smack.h
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-04-03 09:37:02 -0700
committerZiyan <jaraidaniel@gmail.com>2016-03-11 16:01:50 +0100
commitd2bd50e0bd635e7ecd042ddc7a48f3e7b6bdaaac (patch)
tree75e6b4712f640bc9932a7ebecf558452d5524d7e /security/smack/smack.h
parent727ea2d0a7ffb959453a87b0f35ebb4ff9448d50 (diff)
downloadkernel_samsung_espresso10-d2bd50e0bd635e7ecd042ddc7a48f3e7b6bdaaac.zip
kernel_samsung_espresso10-d2bd50e0bd635e7ecd042ddc7a48f3e7b6bdaaac.tar.gz
kernel_samsung_espresso10-d2bd50e0bd635e7ecd042ddc7a48f3e7b6bdaaac.tar.bz2
LSM: shrink sizeof LSM specific portion of common_audit_data
Linus found that the gigantic size of the common audit data caused a big perf hit on something as simple as running stat() in a loop. This patch requires LSMs to declare the LSM specific portion separately rather than doing it in a union. Thus each LSM can be responsible for shrinking their portion and don't have to pay a penalty just because other LSMs have a bigger space requirement. Signed-off-by: Eric Paris <eparis@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/smack/smack.h')
-rw-r--r--security/smack/smack.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/security/smack/smack.h b/security/smack/smack.h
index 2b6c6a5..789adfb 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -180,6 +180,15 @@ struct smack_known {
*/
#define SMK_NUM_ACCESS_TYPE 4
+/* SMACK data */
+struct smack_audit_data {
+ const char *function;
+ char *subject;
+ char *object;
+ char *request;
+ int result;
+};
+
/*
* Smack audit data; is empty if CONFIG_AUDIT not set
* to save some stack
@@ -187,6 +196,7 @@ struct smack_known {
struct smk_audit_info {
#ifdef CONFIG_AUDIT
struct common_audit_data a;
+ struct smack_audit_data sad;
#endif
};
/*
@@ -305,7 +315,8 @@ static inline void smk_ad_init(struct smk_audit_info *a, const char *func,
{
memset(a, 0, sizeof(*a));
a->a.type = type;
- a->a.smack_audit_data.function = func;
+ a->a.smack_audit_data = &a->sad;
+ a->a.smack_audit_data->function = func;
}
static inline void smk_ad_setfield_u_tsk(struct smk_audit_info *a,