security/landlock/ruleset.h
Source file repositories/reference/linux-study-clean/security/landlock/ruleset.h
File Facts
- System
- Linux kernel
- Corpus path
security/landlock/ruleset.h- Extension
.h- Size
- 9405 bytes
- Lines
- 331
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cleanup.hlinux/err.hlinux/mutex.hlinux/rbtree.hlinux/refcount.hlinux/workqueue.haccess.hlimits.hobject.h
Detected Declarations
struct landlock_hierarchystruct landlock_layerstruct landlock_idstruct landlock_rulestruct landlock_rulesetenum landlock_key_typefunction landlock_get_rulesetfunction landlock_union_access_masksfunction landlock_add_fs_access_maskfunction landlock_add_net_access_maskfunction landlock_add_scope_maskfunction landlock_get_fs_access_maskfunction landlock_get_net_access_maskfunction landlock_get_scope_mask
Annotated Snippet
struct landlock_layer {
/**
* @level: Position of this layer in the layer stack. Starts from 1.
*/
u8 level;
/**
* @flags: Bitfield for special flags attached to this rule.
*/
struct {
/**
* @quiet: Suppresses denial logs for the object covered by this
* rule in this domain. For filesystem rules, this inherits
* down the file hierarchy.
*/
u8 quiet : 1;
} flags;
/**
* @access: Bitfield of allowed actions on the kernel object. They are
* relative to the object type (e.g. %LANDLOCK_ACTION_FS_READ).
*/
access_mask_t access;
};
/**
* union landlock_key - Key of a ruleset's red-black tree
*/
union landlock_key {
/**
* @object: Pointer to identify a kernel object (e.g. an inode).
*/
struct landlock_object *object;
/**
* @data: Raw data to identify an arbitrary 32-bit value
* (e.g. a TCP port).
*/
uintptr_t data;
};
/**
* enum landlock_key_type - Type of &union landlock_key
*/
enum landlock_key_type {
/**
* @LANDLOCK_KEY_INODE: Type of &landlock_ruleset.root_inode's node
* keys.
*/
LANDLOCK_KEY_INODE = 1,
/**
* @LANDLOCK_KEY_NET_PORT: Type of &landlock_ruleset.root_net_port's
* node keys.
*/
LANDLOCK_KEY_NET_PORT,
};
/**
* struct landlock_id - Unique rule identifier for a ruleset
*/
struct landlock_id {
/**
* @key: Identifies either a kernel object (e.g. an inode) or
* a raw value (e.g. a TCP port).
*/
union landlock_key key;
/**
* @type: Type of a landlock_ruleset's root tree.
*/
const enum landlock_key_type type;
};
/**
* struct landlock_rule - Access rights tied to an object
*/
struct landlock_rule {
/**
* @node: Node in the ruleset's red-black tree.
*/
struct rb_node node;
/**
* @key: A union to identify either a kernel object (e.g. an inode) or
* a raw data value (e.g. a network socket port). This is used as a key
* for this ruleset element. The pointer is set once and never
* modified. It always points to an allocated object because each rule
* increments the refcount of its object.
*/
union landlock_key key;
/**
* @num_layers: Number of entries in @layers.
*/
u32 num_layers;
/**
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/err.h`, `linux/mutex.h`, `linux/rbtree.h`, `linux/refcount.h`, `linux/workqueue.h`, `access.h`, `limits.h`.
- Detected declarations: `struct landlock_hierarchy`, `struct landlock_layer`, `struct landlock_id`, `struct landlock_rule`, `struct landlock_ruleset`, `enum landlock_key_type`, `function landlock_get_ruleset`, `function landlock_union_access_masks`, `function landlock_add_fs_access_mask`, `function landlock_add_net_access_mask`.
- Atlas domain: Core OS / Security And Isolation.
- Implementation status: source implementation candidate.
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.