sys_landlock_create_ruleset(9)
π NAME π
sys_landlock_create_ruleset β Create a new ruleset
okay so welcome to the Kernel API Manual, bestie π this one's all about sys_landlock_create_ruleset(9), and yes she's a syscall, yes she's iconic, let's get into it.
β¨ SYNOPSIS β¨
long sys_landlock_create_ruleset (const struct landlock_ruleset_attr
__user *const attr , const size_t size , const __u32 flags );
literally the whole signature, character for character, no notes π
π«Ά ARGUMENTS π«Ά
attrβ a pointer to astruct landlock_ruleset_attr, and what she does is identify the scope of the new ruleset. that's her whole job πsizeβ the size of thestruct landlock_ruleset_attrthatattrpoints at. why do we need it? for backward and forward compatibility, periodt. she's thinking about the future π¦flagsβ the supported values are:LANDLOCK_CREATE_RULESET_VERSIONLANDLOCK_CREATE_RULESET_ERRATA
(yes those two bullets are listed right here under ARGUMENTS, and also show up in DESCRIPTION β the manpage is just being extra, we love her for it π )
πΈ DESCRIPTION πΈ
So this system call enables you to create a new Landlock ruleset. that's the vibe. new ruleset, fresh start, main character energy π
The flag values, one more time for the people in the back:
LANDLOCK_CREATE_RULESET_VERSIONLANDLOCK_CREATE_RULESET_ERRATA
β οΈ important, no cap: ifLANDLOCK_CREATE_RULESET_VERSIONorLANDLOCK_CREATE_RULESET_ERRATAis set, thenattrmust beNULLandsizemust be0. do not fight this. she is very clear about it π«Ά
And here's the error list, which the page drops right here in DESCRIPTION (we'll talk about that in RETURN, don't worry π):
EOPNOTSUPPβ Landlock is supported by the kernel but disabled at boot time. she's home but she's not answering the door πEINVALβ unknownflags, or unknown access, or unknown scope, or too smallsize. something in there just doesn't add up πEINVALβquiet_access_fs,quiet_access_net, orquiet_scopedis not a subset of the correspondinghandled_access_fs,handled_access_net, orscoped. yeah. that relationship is not giving subset energy π₯E2BIGβattrorsizeinconsistenciesEFAULTβattrorsizeinconsistenciesENOMSGβ emptylandlock_ruleset_attr.handled_access_fs. nothing in the bag, nothing to work with π
aaaand the page also carries this lil directive, copied exactly because it's literally part of the page:
.. kernel-doc:: include/uapi/linux/landlock.h :identifiers:
landlock_create_ruleset_flags
β RETURN β
Here's what you get back, bestie:
- the ruleset file descriptor on success π
- the Landlock ABI version if
LANDLOCK_CREATE_RULESET_VERSIONis set - the errata value if
LANDLOCK_CREATE_RULESET_ERRATAis set - or
-errnoon failure π
And the page ends this section with the line Possible returned errors are: β which is a little silly because the actual error bullets are chilling up in DESCRIPTION (scroll up, iykyk π). we're keeping it exactly as written because that's the page's business, not ours π
π¦ SEE ALSO π¦
- Kernel file
./security/landlock/syscalls.c copy_min_struct_from_user(9)sys_landlock_add_rule(9)sys_landlock_restrict_self(9)
go read those next, they're the friend group π
that's the whole page, mwah π source/version vibes come courtesy of ./security/landlock, dated October 2026 β and sys_landlock_create_ruleset(9) is the name, see you in the group chat π§ββοΈβ¨
π¦ 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