include/linux/lsm_hooks.h
Source file repositories/reference/linux-study-clean/include/linux/lsm_hooks.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/lsm_hooks.h- Extension
.h- Size
- 7046 bytes
- Lines
- 220
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
uapi/linux/lsm.hlinux/security.hlinux/init.hlinux/rculist.hlinux/xattr.hlinux/static_call.hlinux/unroll.hlinux/jump_label.hlinux/lsm_count.hlsm_hook_defs.hlinux/lsm_hook_defs.h
Detected Declarations
struct lsm_static_callstruct lsm_static_calls_tablestruct lsm_idstruct security_hook_liststruct lsm_blob_sizesstruct lsm_infoenum lsm_order
Annotated Snippet
* @initcall_core: LSM callback for core_initcall() setup, optional
* @initcall_subsys: LSM callback for subsys_initcall() setup, optional
* @initcall_fs: LSM callback for fs_initcall setup, optional
* @initcall_device: LSM callback for device_initcall() setup, optional
* @initcall_late: LSM callback for late_initcall() setup, optional
*/
struct lsm_info {
const struct lsm_id *id;
enum lsm_order order;
unsigned long flags;
struct lsm_blob_sizes *blobs;
int *enabled;
int (*init)(void);
int (*initcall_pure)(void);
int (*initcall_early)(void);
int (*initcall_core)(void);
int (*initcall_subsys)(void);
int (*initcall_fs)(void);
int (*initcall_device)(void);
int (*initcall_late)(void);
};
#define DEFINE_LSM(lsm) \
static struct lsm_info __lsm_##lsm \
__used __section(".lsm_info.init") \
__aligned(sizeof(unsigned long))
#define DEFINE_EARLY_LSM(lsm) \
static struct lsm_info __early_lsm_##lsm \
__used __section(".early_lsm_info.init") \
__aligned(sizeof(unsigned long))
/* DO NOT tamper with these variables outside of the LSM framework */
extern struct lsm_static_calls_table static_calls_table __ro_after_init;
/**
* lsm_get_xattr_slot - Return the next available slot and increment the index
* @xattrs: array storing LSM-provided xattrs
* @xattr_count: number of already stored xattrs (updated)
*
* Retrieve the first available slot in the @xattrs array to fill with an xattr,
* and increment @xattr_count.
*
* Return: The slot to fill in @xattrs if non-NULL, NULL otherwise.
*/
static inline struct xattr *lsm_get_xattr_slot(struct xattr *xattrs,
int *xattr_count)
{
if (unlikely(!xattrs))
return NULL;
return &xattrs[(*xattr_count)++];
}
#endif /* ! __LINUX_LSM_HOOKS_H */
Annotation
- Immediate include surface: `uapi/linux/lsm.h`, `linux/security.h`, `linux/init.h`, `linux/rculist.h`, `linux/xattr.h`, `linux/static_call.h`, `linux/unroll.h`, `linux/jump_label.h`.
- Detected declarations: `struct lsm_static_call`, `struct lsm_static_calls_table`, `struct lsm_id`, `struct security_hook_list`, `struct lsm_blob_sizes`, `struct lsm_info`, `enum lsm_order`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: integration 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.