diff options
author | Eric Paris <eparis@redhat.com> | 2012-04-03 12:37:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-03 12:48:40 -0400 |
commit | 3b3b0e4fc15efa507b902d90cea39e496a523c3b (patch) | |
tree | d7b91c21ad6c6f4ac21dd51297b74eec47c61684 /security/smack/smack.h | |
parent | 95694129b43165911dc4e8a972f0d39ad98d86be (diff) |
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.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/security/smack/smack.h b/security/smack/smack.h index 2ad00657b801..ccba3823d9ef 100644 --- a/security/smack/smack.h +++ b/security/smack/smack.h | |||
@@ -185,6 +185,15 @@ struct smack_known { | |||
185 | */ | 185 | */ |
186 | #define SMK_NUM_ACCESS_TYPE 5 | 186 | #define SMK_NUM_ACCESS_TYPE 5 |
187 | 187 | ||
188 | /* SMACK data */ | ||
189 | struct smack_audit_data { | ||
190 | const char *function; | ||
191 | char *subject; | ||
192 | char *object; | ||
193 | char *request; | ||
194 | int result; | ||
195 | }; | ||
196 | |||
188 | /* | 197 | /* |
189 | * Smack audit data; is empty if CONFIG_AUDIT not set | 198 | * Smack audit data; is empty if CONFIG_AUDIT not set |
190 | * to save some stack | 199 | * to save some stack |
@@ -192,6 +201,7 @@ struct smack_known { | |||
192 | struct smk_audit_info { | 201 | struct smk_audit_info { |
193 | #ifdef CONFIG_AUDIT | 202 | #ifdef CONFIG_AUDIT |
194 | struct common_audit_data a; | 203 | struct common_audit_data a; |
204 | struct smack_audit_data sad; | ||
195 | #endif | 205 | #endif |
196 | }; | 206 | }; |
197 | /* | 207 | /* |
@@ -311,7 +321,8 @@ static inline void smk_ad_init(struct smk_audit_info *a, const char *func, | |||
311 | { | 321 | { |
312 | memset(a, 0, sizeof(*a)); | 322 | memset(a, 0, sizeof(*a)); |
313 | a->a.type = type; | 323 | a->a.type = type; |
314 | a->a.smack_audit_data.function = func; | 324 | a->a.smack_audit_data = &a->sad; |
325 | a->a.smack_audit_data->function = func; | ||
315 | } | 326 | } |
316 | 327 | ||
317 | static inline void smk_ad_setfield_u_tsk(struct smk_audit_info *a, | 328 | static inline void smk_ad_setfield_u_tsk(struct smk_audit_info *a, |