STRUCT LANDLOCK_FILE_SECURITY(9)
π¦ struct landlock_file_security(9) β the Kernel API Manual, bestie edition π¦
Okay so this is a page from the Kernel API Manual about struct landlock_file_security, aka the vibes-holder for a file's security blob. Think of it as the little diary Landlock keeps about a file the moment it gets opened. π
β¨ NAME β¨
struct landlock_file_security β the File security blob. That's it, that's the whole name. Iconic, lowkey.
πΈ SYNOPSIS πΈ
struct landlock_file_security {
access_mask_t allowed_access;
#ifdef CONFIG_SECURITY_LANDLOCK_LOG;
deny_masks_t deny_masks;
optional_access_t quiet_optional_accesses;
u8 fown_layer;
#endif ;
struct landlock_cred_security fown_subject;
struct pid *fown_tg;
};
Not me showing you the whole struct like it's a fit pic π β it's literally copied character for character, #ifdef, stray #endif ; semicolon and all. Do not come for me about that semicolon, it's in the source, periodt.
π Members π
allowed_accessβ the access rights that were actually available at the time the file was opened. π«Ά Quick heads up though: this is not necessarily the full set of access rights that existed at that moment β it's the necessary subset you need in order to authorize later operations on the already-open file. So it's the "enough to get by" mask, not the whole closet.deny_masksβ domain layer levels that deny an optional access. See_LANDLOCK_ACCESS_FS_OPTIONAL. It's giving "the bouncer with the list." π«quiet_optional_accessesβ stores which optional accesses are covered by quiet rules within the layer referred to indeny_masks, one access per bit. β But bestie, be aware: it does not take into account whether the quiet access bits are actually set in the layer's correspondinglandlock_hierarchy. So it's the intention, not the receipt. πfown_layerβ the layer level offown_subject->domainwithLANDLOCK_SCOPE_SIGNAL. π«fown_subjectβ the Landlock credential of the task that set the PID that may receive a signal, e.g.SIGURGwhen writingMSG_OOBto the related socket. This pointer is protected by the relatedfile->f_owner->lock, same as forfown_struct's members:pid,uid, andeuid. π Lock-taken care of, no cap.fown_tgβ the thread group of the task that set the file owner, pinned whilefown_subjectholds a domain. It letshook_file_send_sigiotaskalways allow aSIGIOdelivered to the owner's own process β e.g. the thread-group leader reached through a process-group owner β matching the same-process exemption ofhook_task_kill. It'sNULLwhen no domain is recorded. π Protected byfile->f_owner->lock, likefown_subject. Same lock, same energy, they're a package deal.
π Description π
So this information gets populated when you open a file in hook_file_open, and it tracks the relevant Landlock access rights that were available at the time of opening the file. β¨ Then other LSM hooks use these rights in order to authorize operations on files that are already opened. It's giving "receipts from the moment of purchase so later you can prove what you were allowed to do." π§Ύπ
π SEE ALSO π
Kernel file ./security/landlock/fs.h, plus these absolute icons:
struct landlock_inode_security(9)struct landlock_superblock_security(9)resolve_path_for_trace(9)
Go read them, iykyk. π
π Friendly reminder bestie: this page lives at ./security/landlock and it's dated October 2026. That's the source/version and the date, all folded into this cute little sign-off. Mwah, slay, bye! ππ¦π₯
π¦ 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