landlock_store_rule(9)
β¨ landlock_store_rule(9) β¨
okay bestie, so this is a page from the Kernel API Manual (kernel land, we love her) and it's all about landlock_store_rule β the little function that creates a rule and inserts it into the rule storage. π
Two jobs, one function, main character energy fr fr.
π SYNOPSIS π
int landlock_store_rule (struct landlock_rules *const rules , const
struct landlock_id id , const struct landlock_layer (*layers)[] , const
size_t num_layers );
like, yes, it's a whole mouthful. we'll go through every single piece, no cap. π«Ά
πΈ ARGUMENTS πΈ
rulesβ the rule storage that's getting updated. bestie this one comes with a whole responsibility speech π the caller is on the hook for any locking that's required. for rulesets, that literally means holdinglandlock_ruleset.lock. for domains that are still under construction? no lock needed, because the domain isn't visible to other tasks yet β it's giving "not yet perceived, not yet a problem" β¨idβ the ID you're building the shiny new rule with. and if there's an underlying kernel object involved, the caller must already be holding it. π«Άlayersβ one or multiple layers, and they get copied into the new rule. πnum_layersβ the number oflayersentries. simple as that. β
π¦ DESCRIPTION π¦
so here's the tea. β when user space asks to add a new rule to a ruleset, layers only contains one entry, and that entry is not assigned to any level. in that case, the new rule will extend rules β think of it like a boolean OR between access rights. slay, very additive, very "yes and". π
but when you're merging a ruleset into a domain, or copying a domain? layers gets added to rules as new constraints β like a boolean AND between access rights. π₯ very "hold up, you need both". iconic behavior honestly.
π RETURN π
0on success π-errnoon failure π
π§ SEE ALSO π§
- Kernel file
./security/landlock/ruleset.c
ngl bestie, if you're locking stuff by hand here, please actually lock it. i'm not mad, i'm just saying. π
and that's the page!! shipped to you from ./security/landlock, dated October 2026 β mwah, love u, go read ruleset.c πππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms