audit: remove audit_log_start() contention in AUDIT_USER type calls
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | selinux: call WARN_ONCE() instead of calling audit_log_start()security/ | +4 | 0 replies | |
| 2/3 | smack: call WARN_ONCE() instead of calling audit_log_start()security/ | +2 | 2 replies | |
| 3/3 | audit: drop audit_cmd_lock in AUDIT_USER family of caseskernel/ | +2 | 1 reply |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | [email protected] | [email protected] |
|---|---|---|
| Series | R-b | |
| 1/3 | ||
| 2/3 | ||
| 3/3 | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/3] audit: remove audit_log_start() contention in AUDIT_USER type calls
There is a race condition between systemd and auditd:
systemd |auditd
-------------------------------------------+-----------------------------------
... |
-> audit_receive |...
-> mutex_lock(&audit_cmd_mutex) |-> audit_receive
... -> audit_log_start | -> mutex_lock(&audit_cmd_mutex)
-> wait_for_auditd | // wait for systemd
-> schedule_timeout(60*HZ) |This fix will take care of systemd and anything USING audit. It still means that we could race with something configuring audit and auditd shutting down.
The idea of dropping the lock at the top of audit_receive_msg() isn't as clean as I had hoped, with AUDIT_ADD_RULE, AUDIT_TRIM, AUDIT_MAKE_EQUIV all potentially allocating additional audit buffers indirectly through trim_marked(). It may make sense to have trim_marked() send its queue through a new thread.
Richard Guy Briggs (3):
selinux: call WARN_ONCE() instead of calling audit_log_start()
smack: call WARN_ONCE() instead of calling audit_log_start()
audit: drop audit_cmd_lock in AUDIT_USER family of cases
kernel/audit.c | 2 ++ security/selinux/ss/services.c | 12 ++++-------- security/smack/smack_lsm.c | 5 ++--- 3 files changed, 8 insertions(+), 11 deletions(-)