landlock_res...t_self_flags(9)
π landlock_restrict_self_flags π
okay so this is the Kernel API Manual entry for landlock_restrict_self_flags, and honestly? it's giving "tiny flag, huge security energy" β¨ buckle up bestie, we're reading the flags π
β¨ Flags β¨
So by default, when a program sandboxes itself and gets denied on something, that denial gets logged through the audit subsystem. and likeβ¦ that's on purpose π«Ά because those events typically mean something unexpected is happening β a bug, or someone trying to exploit stuff π
But β and this is the key part β to avoid excessive logging, access requests that get denied by a domain not created by the originating program are not logged by default. the rationale is lowkey iconic: programs should know their own behavior, but not necessarily the behavior of other programs. periodt π this default setup is suitable for most programs that sandbox themselves.
For specific use cases tho, the following flags let programs modify that default logging behavior π
Quick note before the list: the LANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFF and LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON flags apply to the newly created Landlock domain π¦
LANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFFβ Disables logging of denied accesses originating from the thread creating the Landlock domain, as well as its children, as long as they continue running the same executable code (i.e., without an interveningexecve(2)call). This is intended for programs that execute unknown code without invokingexecve(2), such as script interpreters. Programs that only sandbox themselves should not set this flag, so users can be notified of unauthorized access attempts via system logs πΈLANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ONβ Enables logging of denied accesses after anexecve(2)call, providing visibility into unauthorized access attempts by newly executed programs within the created Landlock domain. This flag is recommended only when all potential executables in the domain are expected to comply with the access restrictions, as excessive audit log entries could make it more difficult to identify critical events πLANDLOCK_RESTRICT_SELF_LOG_SUBDOMAINS_OFFβ Disables logging of denied accesses originating from nested Landlock domains created by the caller or its descendants. This flag should be set according to runtime configuration, not hardcoded, to avoid suppressing important security events β οΈ It is useful for container runtimes or sandboxing tools that may launch programs which themselves create Landlock domains and could otherwise generate excessive logs. UnlikeLANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFF, this flag only affects future nested domains, not the one being created. It can also be used with aruleset_fdvalue of-1to mute subdomain logs without creating a domain. When combined withLANDLOCK_RESTRICT_SELF_TSYNCand aruleset_fdvalue of-1, this configuration is propagated to all threads of the current process π§
okay next up β the following flag supports policy enforcement in multithreaded processes π―ββοΈ
LANDLOCK_RESTRICT_SELF_TSYNCβ Applies the new Landlock configuration atomically to all threads of the current process, including the Landlock domain and logging configuration. This overrides the Landlock configuration of sibling threads, irrespective of previously established Landlock domains and logging configurations on these threads. no cap, it just takes over π
If the calling thread is running with no_new_privs, this operation enables no_new_privs on the sibling threads as well π«Ά
and the following flag ties the no_new_privs attribute to the ruleset enforcement π₯
LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVSβ Sets theno_new_privsattribute of the calling thread only once the enforcement of the ruleset succeeded:no_new_privsis set if and only ifsys_landlock_restrict_selfsucceeds. This removes the need for a priorprctl(2)PR_SET_NO_NEW_PRIVScall (orCAP_SYS_ADMINuse). This flag requires a ruleset β οΈ When combined withLANDLOCK_RESTRICT_SELF_TSYNC,no_new_privsis set on the sibling threads as well π
π SEE ALSO π
- Kernel file
./include/uapi/linux/landlock.hstructlandlock_ruleset_attr(9) landlock_create_ruleset_flags(9)landlock_add_rule_flags(9)enum landlock_rule_type(9)struct landlock_path_beneath_attr(9)struct landlock_net_port_attr(9)fs_access(9)net_access(9)scope(9)
bestie reminder: go read the whole crew, they all connect π¦β¨
and that's the page!! shipped straight out of ./include/uapi/linux, stamped October 2026, filed under landlock_res...t_self_flags(9) β go be iconic with your sandboxes, ily π
ππ
π¦ 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