Lines Matching +full:protect +full:- +full:exec
1 /* SPDX-License-Identifier: GPL-2.0 */
43 #define FS_OPEN_EXEC 0x00001000 /* File was opened for exec */
57 #define FS_OPEN_EXEC_PERM 0x00040000 /* open/exec event in a permission hook */
73 * Directory entry modification events - reported only to directory
125 * handle_event - main call for a group to handle an fs event
130 * @dir: optional directory associated with event -
137 * handle_inode_event - simple variant of handle_event() for groups that only
142 * @dir: optional directory associated with event -
145 * Either @inode or @dir must be non-NULL.
149 * free_group_priv - called when a group refcnt hits 0 to clean up the private union
150 * freeing_mark - called when a mark is being destroyed for some reason. The group
199 spinlock_t notification_lock; /* protect the notification_list */
210 #define FS_PRIO_2 2 /* fanotify pre-content access */
221 struct mutex mark_mutex; /* protect marks_list */
266 mutex_lock(&group->mark_mutex); in fsnotify_group_lock()
267 if (group->flags & FSNOTIFY_GROUP_NOFS) in fsnotify_group_lock()
268 group->owner_flags = memalloc_nofs_save(); in fsnotify_group_lock()
273 if (group->flags & FSNOTIFY_GROUP_NOFS) in fsnotify_group_unlock()
274 memalloc_nofs_restore(group->owner_flags); in fsnotify_group_unlock()
275 mutex_unlock(&group->mark_mutex); in fsnotify_group_unlock()
280 WARN_ON_ONCE(!mutex_is_locked(&group->mark_mutex)); in fsnotify_group_assert_locked()
281 if (group->flags & FSNOTIFY_GROUP_NOFS) in fsnotify_group_assert_locked()
282 WARN_ON_ONCE(!(current->flags & PF_MEMALLOC_NOFS)); in fsnotify_group_assert_locked()
308 return d_inode(((const struct path *)data)->dentry); in fsnotify_data_inode()
310 return ((struct fs_error_report *)data)->inode; in fsnotify_data_inode()
323 return ((const struct path *)data)->dentry; in fsnotify_data_dentry()
345 return ((struct inode *)data)->i_sb; in fsnotify_data_sb()
347 return ((struct dentry *)data)->d_sb; in fsnotify_data_sb()
349 return ((const struct path *)data)->dentry->d_sb; in fsnotify_data_sb()
351 return ((struct fs_error_report *) data)->sb; in fsnotify_data_sb()
387 FSNOTIFY_OBJ_TYPE_ANY = -1,
410 return (iter_info->report_mask & (1U << iter_type)); in fsnotify_iter_should_report_type()
416 iter_info->report_mask |= (1U << iter_type); in fsnotify_iter_set_report_type()
423 return iter_info->marks[iter_type]; in fsnotify_iter_mark()
497 * particular entry. obj_lock means either inode->i_lock or
498 * mnt->mnt_root->d_lock depending on the mark type.
501 /* Mask this mark is for [mark->lock, group->mark_mutex] */
509 /* List of marks by group->marks_list. Also reused for queueing
511 * before it can be freed. [group->mark_mutex] */
515 /* List of marks for inode / vfsmount [connector->lock, mark ref] */
519 /* Events types and flags to ignore [mark->lock, group->mark_mutex] */
533 unsigned int flags; /* flags [mark->lock] */
567 if (!(inode->i_fsnotify_mask & FS_EVENT_ON_CHILD)) in fsnotify_inode_watches_children()
571 return inode->i_fsnotify_mask & FS_EVENTS_POSS_ON_CHILD; in fsnotify_inode_watches_children()
576 * filesystem events when those events happens to this dentry->d_inode.
580 assert_spin_locked(&dentry->d_lock); in fsnotify_update_flags()
589 if (fsnotify_inode_watches_children(dentry->d_parent->d_inode)) in fsnotify_update_flags()
590 dentry->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED; in fsnotify_update_flags()
592 dentry->d_flags &= ~DCACHE_FSNOTIFY_PARENT_WATCHED; in fsnotify_update_flags()
633 fsnotify_add_event(group, group->overflow_event, NULL); in fsnotify_queue_overflow()
643 assert_spin_locked(&group->notification_lock); in fsnotify_notify_queue_is_empty()
645 return list_empty(&group->notification_list); in fsnotify_notify_queue_is_empty()
662 * Note the subtle semantic difference from the legacy ->ignored_mask.
663 * ->ignored_mask traditionally only meant which events should be ignored,
664 * while ->ignore_mask also includes flags regarding the type of objects on
669 __u32 ignore_mask = mark->ignore_mask; in fsnotify_ignore_mask()
672 if (mark->flags & FSNOTIFY_MARK_FLAG_HAS_IGNORE_FLAGS) in fsnotify_ignore_mask()
677 * - Always ignore events on dir in fsnotify_ignore_mask()
678 * - Ignore events on child if parent is watching children in fsnotify_ignore_mask()
682 ignore_mask |= mark->mask & FS_EVENT_ON_CHILD; in fsnotify_ignore_mask()
687 /* Legacy ignored_mask - only event types to ignore */
690 return mark->ignore_mask & ALL_FSNOTIFY_EVENTS; in fsnotify_ignored_events()
724 /* For non-dir and non-child, no need to consult the event flags */ in fsnotify_effective_ignore_mask()
738 __u32 mask = mark->mask; in fsnotify_calc_mask()
744 if (!(mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)) in fsnotify_calc_mask()
751 return mask | mark->ignore_mask; in fsnotify_calc_mask()
776 return fsnotify_add_mark(mark, &inode->i_fsnotify_marks, in fsnotify_add_inode_mark()
783 return fsnotify_add_mark_locked(mark, &inode->i_fsnotify_marks, in fsnotify_add_inode_mark_locked()
821 INIT_LIST_HEAD(&event->list); in fsnotify_init_event()