Skip to content

Commit

Permalink
The success and return_code are needed by the filters. Move
Browse files Browse the repository at this point in the history
audit_return_fixup() before the filters.  This was causing syscall
auditing events to be missed.

Link: #138
Cc: stable@vger.kernel.org
Fixes: 12c5e81 ("audit: prepare audit_context for use in calling contexts beyond syscalls")
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
[PM: manual merge required]
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
rgbriggs authored and pcmoore committed Aug 25, 2022
1 parent ad982c3 commit 1b2263a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/auditsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,7 @@ void __audit_uring_exit(int success, long code)
goto out;
}

audit_return_fixup(ctx, success, code);
if (ctx->context == AUDIT_CTX_SYSCALL) {
/*
* NOTE: See the note in __audit_uring_entry() about the case
Expand Down Expand Up @@ -1981,7 +1982,6 @@ void __audit_uring_exit(int success, long code)
audit_filter_inodes(current, ctx);
if (ctx->current_state != AUDIT_STATE_RECORD)
goto out;
audit_return_fixup(ctx, success, code);
audit_log_exit();

out:
Expand Down Expand Up @@ -2065,13 +2065,13 @@ void __audit_syscall_exit(int success, long return_code)
if (!list_empty(&context->killed_trees))
audit_kill_trees(context);

audit_return_fixup(context, success, return_code);
/* run through both filters to ensure we set the filterkey properly */
audit_filter_syscall(current, context);
audit_filter_inodes(current, context);
if (context->current_state < AUDIT_STATE_RECORD)
goto out;

audit_return_fixup(context, success, return_code);
audit_log_exit();

out:
Expand Down

0 comments on commit 1b2263a

Please sign in to comment.