Skip to content

Commit 1320a40

Browse files
rgbriggspcmoore
authored andcommitted
audit: trigger accompanying records when no rules present
When there are no audit rules registered, mandatory records (config, etc.) are missing their accompanying records (syscall, proctitle, etc.). This is due to audit context dummy set on syscall entry based on absence of rules that signals that no other records are to be printed. Clear the dummy bit if any record is generated. The proctitle context and dummy checks are pointless since the proctitle record will not be printed if no syscall records are printed. Please see upstream github issue linux-audit/audit-kernel#120 Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 70b3eee commit 1320a40

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

kernel/audit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,6 +1798,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
17981798
}
17991799

18001800
audit_get_stamp(ab->ctx, &t, &serial);
1801+
audit_clear_dummy(ab->ctx);
18011802
audit_log_format(ab, "audit(%llu.%03lu:%u): ",
18021803
(unsigned long long)t.tv_sec, t.tv_nsec/1000000, serial);
18031804

kernel/audit.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,13 @@ extern int audit_signal_info_syscall(struct task_struct *t);
290290
extern void audit_filter_inodes(struct task_struct *tsk,
291291
struct audit_context *ctx);
292292
extern struct list_head *audit_killed_trees(void);
293+
294+
static inline void audit_clear_dummy(struct audit_context *ctx)
295+
{
296+
if (ctx)
297+
ctx->dummy = 0;
298+
}
299+
293300
#else /* CONFIG_AUDITSYSCALL */
294301
#define auditsc_get_stamp(c, t, s) 0
295302
#define audit_put_watch(w) {}
@@ -323,6 +330,7 @@ static inline int audit_signal_info_syscall(struct task_struct *t)
323330
}
324331

325332
#define audit_filter_inodes(t, c) AUDIT_DISABLED
333+
#define audit_clear_dummy(c) {}
326334
#endif /* CONFIG_AUDITSYSCALL */
327335

328336
extern char *audit_unpack_string(void **bufp, size_t *remain, size_t len);

kernel/auditsc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,9 +1406,6 @@ static void audit_log_proctitle(void)
14061406
struct audit_context *context = audit_context();
14071407
struct audit_buffer *ab;
14081408

1409-
if (!context || context->dummy)
1410-
return;
1411-
14121409
ab = audit_log_start(context, GFP_KERNEL, AUDIT_PROCTITLE);
14131410
if (!ab)
14141411
return; /* audit_panic or being filtered */

0 commit comments

Comments
 (0)