Skip to content

audit: fix recursive locking deadlock and dangling rule removal

Ricardo Robaina audit lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 4 repliesIn review
  2. v12 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Reordered patches
- Refactored audit_alloc_mark() to eliminate code duplication by introducing local dir/child inode variables and unifying the critical execution path
- Added allow_dups variable to preserve original behavior: manual rule additions use allow_dups=0 (no duplicates), fsnotify events use allow_dups=1 (allow temporary coexistence during rename)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2audit: fix removal of dangling executable ruleskernel/audit_fsnotify.c+0 -42 replies
2/2audit: fix recursive locking deadlock in audit_dupe_exe()kernel/audit.h kernel/audit_fsnotify.c kernel/audit_watch.c +1 more+55 -242 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchWaiman LongRichard Guy Briggs
SeriesA-b A-b
1/2A-b A-b
2/2A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] audit: fix recursive locking deadlock and dangling rule removal

This patch series fixes a recursive locking deadlock in audit_dupe_exe() code path, as well as, a bug that prevents the deletion of dangling audit rules.

The first patch, simply removes the d_really_is_negative() check in audit_alloc_mark() to allow dummy mark allocation, fixing the -ENOENT failure when deleting dangling rules for unlinked executables.

The second one, fixes the deadlock in audit_dupe_exe() by introducing the audit_watch_ctx struct to pass the fsnotify event context down the call chain. This safely bypasses the need for kern_path_parent() during move events, avoiding a double acquisition of the I_MUTEX_PARENT lock.

---
Changes in v2:
- Reordered patches
- Refactored audit_alloc_mark() to eliminate code duplication by introducing local dir/child inode variables and unifying the critical execution path
- Added allow_dups variable to preserve original behavior: manual rule additions use allow_dups=0 (no duplicates), fsnotify events use allow_dups=1 (allow temporary coexistence during rename)

Ricardo Robaina (2):
audit: fix removal of dangling executable rules
audit: fix recursive locking deadlock in audit_dupe_exe()

 kernel/audit.h          | 13 ++++++++++---
 kernel/audit_fsnotify.c | 34 ++++++++++++++++++++++------------
 kernel/audit_watch.c    | 25 +++++++++++++++++--------
 kernel/auditfilter.c    |  9 +++++----
 4 files changed, 54 insertions(+), 27 deletions(-)
Signature · 1 line
2.53.0