audit: create audit_stamp structure
Replace the timestamp and serial number pair used in audit records with a structure containing the two elements. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> [PM: subj tweak] Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
1 parent
70d0085864
commit
0a561e3904
3 files changed
+27
-25
No files matched your search
+9
-8
@@ -1833,11 +1833,11 @@ unsigned int audit_serial(void)
|
||||
}
|
||||
|
||||
static inline void audit_get_stamp(struct audit_context *ctx,
|
||||
struct timespec64 *t, unsigned int *serial)
|
||||
struct audit_stamp *stamp)
|
||||
{
|
||||
if (!ctx || !auditsc_get_stamp(ctx, t, serial)) {
|
||||
ktime_get_coarse_real_ts64(t);
|
||||
*serial = audit_serial();
|
||||
if (!ctx || !auditsc_get_stamp(ctx, stamp)) {
|
||||
ktime_get_coarse_real_ts64(&stamp->ctime);
|
||||
stamp->serial = audit_serial();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1860,8 +1860,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
|
||||
int type)
|
||||
{
|
||||
struct audit_buffer *ab;
|
||||
struct timespec64 t;
|
||||
unsigned int serial;
|
||||
struct audit_stamp stamp;
|
||||
|
||||
if (audit_initialized != AUDIT_INITIALIZED)
|
||||
return NULL;
|
||||
@@ -1916,12 +1915,14 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
audit_get_stamp(ab->ctx, &t, &serial);
|
||||
audit_get_stamp(ab->ctx, &stamp);
|
||||
/* cancel dummy context to enable supporting records */
|
||||
if (ctx)
|
||||
ctx->dummy = 0;
|
||||
audit_log_format(ab, "audit(%llu.%03lu:%u): ",
|
||||
(unsigned long long)t.tv_sec, t.tv_nsec/1000000, serial);
|
||||
(unsigned long long)stamp.ctime.tv_sec,
|
||||
stamp.ctime.tv_nsec/1000000,
|
||||
stamp.serial);
|
||||
|
||||
return ab;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user