security/landlock/fs.h
Source file repositories/reference/linux-study-clean/security/landlock/fs.h
File Facts
- System
- Linux kernel
- Corpus path
security/landlock/fs.h- Extension
.h- Size
- 5049 bytes
- Lines
- 157
- Domain
- Core OS
- Bucket
- Security And Isolation
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/build_bug.hlinux/fs.hlinux/init.hlinux/rcupdate.haccess.hcred.hruleset.hsetup.h
Detected Declarations
struct landlock_inode_securitystruct landlock_file_securitystruct landlock_superblock_securityfunction landlock_filefunction landlock_inodefunction landlock_superblock
Annotated Snippet
struct landlock_inode_security {
/**
* @object: Weak pointer to an allocated object. All assignments of a
* new object are protected by the underlying inode->i_lock. However,
* atomically disassociating @object from the inode is only protected
* by @object->lock, from the time @object's usage refcount drops to
* zero to the time this pointer is nulled out (cf. release_inode() and
* hook_sb_delete()). Indeed, such disassociation doesn't require
* inode->i_lock thanks to the careful rcu_access_pointer() check
* performed by get_inode_object().
*/
struct landlock_object __rcu *object;
};
/**
* struct landlock_file_security - File security blob
*
* This information is populated when opening a file in hook_file_open, and
* tracks the relevant Landlock access rights that were available at the time
* of opening the file. Other LSM hooks use these rights in order to authorize
* operations on already opened files.
*/
struct landlock_file_security {
/**
* @allowed_access: Access rights that were available at the time of
* opening the file. This is not necessarily the full set of access
* rights available at that time, but it's the necessary subset as
* needed to authorize later operations on the open file.
*/
access_mask_t allowed_access;
#ifdef CONFIG_AUDIT
/**
* @deny_masks: Domain layer levels that deny an optional access (see
* _LANDLOCK_ACCESS_FS_OPTIONAL).
*/
deny_masks_t deny_masks;
/**
* @quiet_optional_accesses: Stores which optional accesses are covered
* by quiet rules within the layer referred to in deny_masks, one access
* per bit. Does not take into account whether the quiet access bits
* are actually set in the layer's corresponding landlock_hierarchy.
*/
optional_access_t quiet_optional_accesses;
/**
* @fown_layer: Layer level of @fown_subject->domain with
* LANDLOCK_SCOPE_SIGNAL.
*/
u8 fown_layer;
#endif /* CONFIG_AUDIT */
/**
* @fown_subject: Landlock credential of the task that set the PID that
* may receive a signal e.g., SIGURG when writing MSG_OOB to the
* related socket. This pointer is protected by the related
* file->f_owner->lock, as for fown_struct's members: pid, uid, and
* euid.
*/
struct landlock_cred_security fown_subject;
/**
* @fown_tg: Thread group of the task that set the file owner, pinned
* while @fown_subject holds a domain. It lets
* hook_file_send_sigiotask() always allow a SIGIO delivered to the
* owner's own process -- e.g. the thread-group leader reached through a
* process-group owner -- matching the same-process exemption of
* hook_task_kill(). NULL when no domain is recorded. Protected by
* file->f_owner->lock, like @fown_subject.
*/
struct pid *fown_tg;
};
#ifdef CONFIG_AUDIT
/* Makes sure all layers can be identified. */
/* clang-format off */
static_assert((typeof_member(struct landlock_file_security, fown_layer))~0 >=
LANDLOCK_MAX_NUM_LAYERS);
/* clang-format on */
/*
* Make sure quiet_optional_accesses has enough bits to cover all optional
* accesses.
*/
static_assert(BITS_PER_TYPE(typeof_member(struct landlock_file_security,
quiet_optional_accesses)) >=
HWEIGHT(_LANDLOCK_ACCESS_FS_OPTIONAL));
#endif /* CONFIG_AUDIT */
/**
Annotation
- Immediate include surface: `linux/build_bug.h`, `linux/fs.h`, `linux/init.h`, `linux/rcupdate.h`, `access.h`, `cred.h`, `ruleset.h`, `setup.h`.
- Detected declarations: `struct landlock_inode_security`, `struct landlock_file_security`, `struct landlock_superblock_security`, `function landlock_file`, `function landlock_inode`, `function landlock_superblock`.
- Atlas domain: Core OS / Security And Isolation.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.