audit watch fixes
PATCH 1/1 audit watch fixes
This patch contains fixes for the audit watch implementation in the git tree.
- deadlock fix: release mutex on error from audit_add_watch
- remove "moved" inotify watches from event handler
- use inotify refcounting for audit_parent data
- register inotify watches before adding rule instead of after; using inotify refcounting, this ensures our audit_watch->parent is valid
- some code consolidation based on above changes
Please take a look and make sure I haven't bungled anything.
Signed-off-by Amy Griffis <[email protected]>
--
audit.c | 8 ++ audit.h | 1 auditfilter.c | 175 ++++++++++++++++++++++------------------------------------ 3 files changed, 75 insertions(+), 109 deletions(-)
kernel/audit.c +7 -1
@@ -680,6 +680,12 @@ static void audit_receive(struct sock *smutex_unlock (&audit_cmd_mutex); } +#ifdef CONFIG_AUDITSYSCALL +static const struct inotify_operations audit_inotify_ops = { + .handle_event = audit_handle_ievent, + .destroy_watch = audit_free_parent, +}; +#endif /* Initialize audit support at boot time. */ static int __init audit_init (void )
@@ -706,7 +712,7 @@ static int __init audit_init(void)audit_log (NULL ,GFP_KERNEL ,AUDIT_KERNEL ,"initialized" );#ifdef CONFIG_AUDITSYSCALL - audit_ih =inotify_init (audit_handle_ievent); + audit_ih =inotify_init (&audit_inotify_ops);if (IS_ERR (audit_ih))audit_panic ("cannot initialize inotify handle" );
kernel/audit.h +1 -0
@@ -122,6 +122,7 @@ struct audit_netlink_list {int audit_send_list (void *);struct inotify_watch ; +extern void audit_free_parent (struct inotify_watch *);extern void audit_handle_ievent (struct inotify_watch *,u32 ,u32 ,u32 ,const char *,struct inode *);extern int selinux_audit_rule_update (void );
kernel/auditfilter.c +67 -108
307 lines not on this page · raw message