aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-18 14:24:46 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-18 14:24:46 -0400
commitce625a801664d8ed7344117bbb57510e4e0e872c (patch)
tree50e6760a0b1b506b234700afddc7296b28918650 /kernel/auditsc.c
parentd5b454f2c40c9efd0cc113bc3220ebcb66b7c022 (diff)
AUDIT: Reduce contention in audit_serial()
... by generating serial numbers only if an audit context is actually _used_, rather than doing so at syscall entry even when the context isn't necessarily marked auditable. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 242d45e53738..46b45abceb9a 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -984,7 +984,7 @@ void audit_syscall_entry(struct task_struct *tsk, int arch, int major,
984 if (likely(state == AUDIT_DISABLED)) 984 if (likely(state == AUDIT_DISABLED))
985 return; 985 return;
986 986
987 context->serial = audit_serial(); 987 context->serial = 0;
988 context->ctime = CURRENT_TIME; 988 context->ctime = CURRENT_TIME;
989 context->in_syscall = 1; 989 context->in_syscall = 1;
990 context->auditable = !!(state == AUDIT_RECORD_CONTEXT); 990 context->auditable = !!(state == AUDIT_RECORD_CONTEXT);
@@ -1138,6 +1138,8 @@ void audit_inode(const char *name, const struct inode *inode, unsigned flags)
1138void auditsc_get_stamp(struct audit_context *ctx, 1138void auditsc_get_stamp(struct audit_context *ctx,
1139 struct timespec *t, unsigned int *serial) 1139 struct timespec *t, unsigned int *serial)
1140{ 1140{
1141 if (!ctx->serial)
1142 ctx->serial = audit_serial();
1141 t->tv_sec = ctx->ctime.tv_sec; 1143 t->tv_sec = ctx->ctime.tv_sec;
1142 t->tv_nsec = ctx->ctime.tv_nsec; 1144 t->tv_nsec = ctx->ctime.tv_nsec;
1143 *serial = ctx->serial; 1145 *serial = ctx->serial;