diff options
author | 2023-10-30 19:44:52 -1000 | |
---|---|---|
committer | 2023-10-30 19:44:52 -1000 | |
commit | b9886c976668cae1614b46922b56f14b467da7be (patch) | |
tree | bcafbbf921744e17cee8f6f9205950a63ca9da4b /kernel | |
parent | Merge tag 'tpmdd-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkk... (diff) | |
parent | audit: don't take task_lock() in audit_exe_compare() code path (diff) | |
download | linux-b9886c976668cae1614b46922b56f14b467da7be.tar.gz linux-b9886c976668cae1614b46922b56f14b467da7be.tar.bz2 linux-b9886c976668cae1614b46922b56f14b467da7be.zip |
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
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit_tree.c | 2 | ||||
-rw-r--r-- | kernel/audit_watch.c | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index e867c17d3f84..85a5b306733b 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c @@ -34,7 +34,7 @@ struct audit_chunk { struct list_head list; struct audit_tree *owner; unsigned index; /* index; upper bit indicates 'will prune' */ - } owners[]; + } owners[] __counted_by(count); }; struct audit_tree_mark { diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 65075f1e4ac8..91e82e34b51e 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c @@ -527,11 +527,18 @@ int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark) unsigned long ino; dev_t dev; - exe_file = get_task_exe_file(tsk); + /* only do exe filtering if we are recording @current events/records */ + if (tsk != current) + return 0; + + if (WARN_ON_ONCE(!current->mm)) + return 0; + exe_file = get_mm_exe_file(current->mm); if (!exe_file) return 0; ino = file_inode(exe_file)->i_ino; dev = file_inode(exe_file)->i_sb->s_dev; fput(exe_file); + return audit_mark_compare(mark, ino, dev); } |