Skip to content

Commit b9886c9

Browse files
committed
Merge tag 'audit-pr-20231030' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit
Pull audit update from Paul Moore: "Only two audit patches for v6.7, both fairly small with a combined 11 lines of changes. The first patch is a simple __counted_by annontation, and the second fixes a a problem where audit could deadlock on task_lock() when an exe filter is configured. More information is available in the commit description and the patch is tagged for stable" * tag 'audit-pr-20231030' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit: audit: don't take task_lock() in audit_exe_compare() code path audit: Annotate struct audit_chunk with __counted_by
2 parents b9ff774 + 47846d5 commit b9886c9

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

kernel/audit_tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct audit_chunk {
3434
struct list_head list;
3535
struct audit_tree *owner;
3636
unsigned index; /* index; upper bit indicates 'will prune' */
37-
} owners[];
37+
} owners[] __counted_by(count);
3838
};
3939

4040
struct audit_tree_mark {

kernel/audit_watch.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,18 @@ int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark)
527527
unsigned long ino;
528528
dev_t dev;
529529

530-
exe_file = get_task_exe_file(tsk);
530+
/* only do exe filtering if we are recording @current events/records */
531+
if (tsk != current)
532+
return 0;
533+
534+
if (WARN_ON_ONCE(!current->mm))
535+
return 0;
536+
exe_file = get_mm_exe_file(current->mm);
531537
if (!exe_file)
532538
return 0;
533539
ino = file_inode(exe_file)->i_ino;
534540
dev = file_inode(exe_file)->i_sb->s_dev;
535541
fput(exe_file);
542+
536543
return audit_mark_compare(mark, ino, dev);
537544
}

0 commit comments

Comments
 (0)