Lines Matching refs:ruleset
116 const struct landlock_ruleset ruleset = { in build_check_ruleset() local
120 typeof(ruleset.fs_access_masks[0]) fs_access_mask = ~0; in build_check_ruleset()
122 BUILD_BUG_ON(ruleset.num_rules < LANDLOCK_MAX_NUM_RULES); in build_check_ruleset()
123 BUILD_BUG_ON(ruleset.num_layers < LANDLOCK_MAX_NUM_LAYERS); in build_check_ruleset()
145 static int insert_rule(struct landlock_ruleset *const ruleset, in insert_rule() argument
155 lockdep_assert_held(&ruleset->lock); in insert_rule()
158 walker_node = &(ruleset->root.rb_node); in insert_rule()
201 rb_replace_node(&this->node, &new_rule->node, &ruleset->root); in insert_rule()
208 if (ruleset->num_rules >= LANDLOCK_MAX_NUM_RULES) in insert_rule()
214 rb_insert_color(&new_rule->node, &ruleset->root); in insert_rule()
215 ruleset->num_rules++; in insert_rule()
231 int landlock_insert_rule(struct landlock_ruleset *const ruleset, in landlock_insert_rule() argument
242 return insert_rule(ruleset, object, &layers, ARRAY_SIZE(layers)); in landlock_insert_rule()
359 static void free_ruleset(struct landlock_ruleset *const ruleset) in free_ruleset() argument
364 rbtree_postorder_for_each_entry_safe(freeme, next, &ruleset->root, node) in free_ruleset()
366 put_hierarchy(ruleset->hierarchy); in free_ruleset()
367 kfree(ruleset); in free_ruleset()
370 void landlock_put_ruleset(struct landlock_ruleset *const ruleset) in landlock_put_ruleset() argument
373 if (ruleset && refcount_dec_and_test(&ruleset->usage)) in landlock_put_ruleset()
374 free_ruleset(ruleset); in landlock_put_ruleset()
379 struct landlock_ruleset *ruleset; in free_ruleset_work() local
381 ruleset = container_of(work, struct landlock_ruleset, work_free); in free_ruleset_work()
382 free_ruleset(ruleset); in free_ruleset_work()
385 void landlock_put_ruleset_deferred(struct landlock_ruleset *const ruleset) in landlock_put_ruleset_deferred() argument
387 if (ruleset && refcount_dec_and_test(&ruleset->usage)) { in landlock_put_ruleset_deferred()
388 INIT_WORK(&ruleset->work_free, free_ruleset_work); in landlock_put_ruleset_deferred()
389 schedule_work(&ruleset->work_free); in landlock_put_ruleset_deferred()
404 struct landlock_ruleset *const ruleset) in landlock_merge_ruleset() argument
411 if (WARN_ON_ONCE(!ruleset || parent == ruleset)) in landlock_merge_ruleset()
440 err = merge_ruleset(new_dom, ruleset); in landlock_merge_ruleset()
455 landlock_find_rule(const struct landlock_ruleset *const ruleset, in landlock_find_rule() argument
462 node = ruleset->root.rb_node; in landlock_find_rule()