aboutsummaryrefslogtreecommitdiffstats
path: root/security/apparmor/lsm.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-04-03 12:37:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-03 12:48:40 -0400
commit3b3b0e4fc15efa507b902d90cea39e496a523c3b (patch)
treed7b91c21ad6c6f4ac21dd51297b74eec47c61684 /security/apparmor/lsm.c
parent95694129b43165911dc4e8a972f0d39ad98d86be (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/apparmor/lsm.c')
-rw-r--r--security/apparmor/lsm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 97ce8fae49b3..ad05d391974d 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -588,10 +588,12 @@ static int apparmor_setprocattr(struct task_struct *task, char *name,
588 error = aa_setprocattr_permipc(args); 588 error = aa_setprocattr_permipc(args);
589 } else { 589 } else {
590 struct common_audit_data sa; 590 struct common_audit_data sa;
591 struct apparmor_audit_data aad = {0,};
591 COMMON_AUDIT_DATA_INIT(&sa, NONE); 592 COMMON_AUDIT_DATA_INIT(&sa, NONE);
592 sa.aad.op = OP_SETPROCATTR; 593 sa.aad = &aad;
593 sa.aad.info = name; 594 aad.op = OP_SETPROCATTR;
594 sa.aad.error = -EINVAL; 595 aad.info = name;
596 aad.error = -EINVAL;
595 return aa_audit(AUDIT_APPARMOR_DENIED, 597 return aa_audit(AUDIT_APPARMOR_DENIED,
596 __aa_current_profile(), GFP_KERNEL, 598 __aa_current_profile(), GFP_KERNEL,
597 &sa, NULL); 599 &sa, NULL);