]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - kernel/auditsc.c
Merge tag 'driver-core-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mirror_ubuntu-eoan-kernel.git] / kernel / auditsc.c
index ecc23e25c9eb2b3aedf5db585905d7b044d6b276..e80459f7e1327731f6960ee5824e22d71037b8c8 100644 (file)
@@ -1869,10 +1869,33 @@ void __audit_inode_child(struct inode *parent,
        struct inode *inode = d_backing_inode(dentry);
        const char *dname = dentry->d_name.name;
        struct audit_names *n, *found_parent = NULL, *found_child = NULL;
+       struct audit_entry *e;
+       struct list_head *list = &audit_filter_list[AUDIT_FILTER_FS];
+       int i;
 
        if (!context->in_syscall)
                return;
 
+       rcu_read_lock();
+       if (!list_empty(list)) {
+               list_for_each_entry_rcu(e, list, list) {
+                       for (i = 0; i < e->rule.field_count; i++) {
+                               struct audit_field *f = &e->rule.fields[i];
+
+                               if (f->type == AUDIT_FSTYPE) {
+                                       if (audit_comparator(parent->i_sb->s_magic,
+                                           f->op, f->val)) {
+                                               if (e->rule.action == AUDIT_NEVER) {
+                                                       rcu_read_unlock();
+                                                       return;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+       rcu_read_unlock();
+
        if (inode)
                handle_one(inode);
 
@@ -2390,6 +2413,12 @@ void __audit_log_kern_module(char *name)
        context->type = AUDIT_KERN_MODULE;
 }
 
+void __audit_fanotify(unsigned int response)
+{
+       audit_log(current->audit_context, GFP_KERNEL,
+               AUDIT_FANOTIFY, "resp=%u", response);
+}
+
 static void audit_log_task(struct audit_buffer *ab)
 {
        kuid_t auid, uid;