Skip to content

Commit

Permalink
audit: prepare audit_context for use in calling contexts beyond syscalls
Browse files Browse the repository at this point in the history
This patch cleans up some of our audit_context handling by
abstracting out the reset and return code fixup handling to dedicated
functions.  Not only does this help make things easier to read and
inspect, it allows for easier reuse by future patches.  We also
convert the simple audit_context->in_syscall flag into an enum which
can be used to by future patches to indicate a calling context other
than the syscall context.

Thanks to Richard Guy Briggs for review and feedback.

Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
pcmoore committed Sep 20, 2021
1 parent 6880fa6 commit 12c5e81
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 94 deletions.
5 changes: 4 additions & 1 deletion kernel/audit.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ struct audit_proctitle {
/* The per-task audit context. */
struct audit_context {
int dummy; /* must be the first element */
int in_syscall; /* 1 if task is in a syscall */
enum {
AUDIT_CTX_UNUSED, /* audit_context is currently unused */
AUDIT_CTX_SYSCALL, /* in use by syscall */
} context;
enum audit_state state, current_state;
unsigned int serial; /* serial number for record */
int major; /* syscall number */
Expand Down
Loading

0 comments on commit 12c5e81

Please sign in to comment.