include/linux/bpf_lsm.h
Source file repositories/reference/linux-study-clean/include/linux/bpf_lsm.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/bpf_lsm.h- Extension
.h- Size
- 2838 bytes
- Lines
- 116
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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/sched.hlinux/bpf.hlinux/bpf_verifier.hlinux/lsm_hooks.hlinux/lsm_hook_defs.h
Detected Declarations
struct bpf_storage_blobfunction bpf_lsm_is_sleepable_hookfunction bpf_lsm_is_trustedfunction bpf_lsm_verify_progfunction bpf_inode_storage_freefunction bpf_set_dentry_xattr_lockedfunction bpf_remove_dentry_xattr_lockedfunction bpf_lsm_has_d_inode_lockedfunction bpf_lsm_hook_returns_errno
Annotated Snippet
struct bpf_storage_blob {
struct bpf_local_storage __rcu *storage;
};
extern struct lsm_blob_sizes bpf_lsm_blob_sizes;
int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
const struct bpf_prog *prog);
bool bpf_lsm_is_sleepable_hook(u32 btf_id);
bool bpf_lsm_is_trusted(const struct bpf_prog *prog);
static inline struct bpf_storage_blob *bpf_inode(
const struct inode *inode)
{
if (unlikely(!inode->i_security))
return NULL;
return inode->i_security + bpf_lsm_blob_sizes.lbs_inode;
}
extern const struct bpf_func_proto bpf_inode_storage_get_proto;
extern const struct bpf_func_proto bpf_inode_storage_delete_proto;
void bpf_inode_storage_free(struct inode *inode);
void bpf_lsm_find_cgroup_shim(const struct bpf_prog *prog, bpf_func_t *bpf_func);
int bpf_lsm_get_retval_range(const struct bpf_prog *prog,
struct bpf_retval_range *range);
int bpf_set_dentry_xattr_locked(struct dentry *dentry, const char *name__str,
const struct bpf_dynptr *value_p, int flags);
int bpf_remove_dentry_xattr_locked(struct dentry *dentry, const char *name__str);
bool bpf_lsm_has_d_inode_locked(const struct bpf_prog *prog);
bool bpf_lsm_hook_returns_errno(u32 btf_id);
#else /* !CONFIG_BPF_LSM */
static inline bool bpf_lsm_is_sleepable_hook(u32 btf_id)
{
return false;
}
static inline bool bpf_lsm_is_trusted(const struct bpf_prog *prog)
{
return false;
}
static inline int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
const struct bpf_prog *prog)
{
return -EOPNOTSUPP;
}
static inline struct bpf_storage_blob *bpf_inode(
const struct inode *inode)
{
return NULL;
}
static inline void bpf_inode_storage_free(struct inode *inode)
{
}
static inline void bpf_lsm_find_cgroup_shim(const struct bpf_prog *prog,
bpf_func_t *bpf_func)
{
}
static inline int bpf_lsm_get_retval_range(const struct bpf_prog *prog,
struct bpf_retval_range *range)
{
return -EOPNOTSUPP;
}
static inline int bpf_set_dentry_xattr_locked(struct dentry *dentry, const char *name__str,
const struct bpf_dynptr *value_p, int flags)
{
return -EOPNOTSUPP;
}
static inline int bpf_remove_dentry_xattr_locked(struct dentry *dentry, const char *name__str)
{
return -EOPNOTSUPP;
}
static inline bool bpf_lsm_has_d_inode_locked(const struct bpf_prog *prog)
{
return false;
}
static inline bool bpf_lsm_hook_returns_errno(u32 btf_id)
{
return true;
Annotation
- Immediate include surface: `linux/sched.h`, `linux/bpf.h`, `linux/bpf_verifier.h`, `linux/lsm_hooks.h`, `linux/lsm_hook_defs.h`.
- Detected declarations: `struct bpf_storage_blob`, `function bpf_lsm_is_sleepable_hook`, `function bpf_lsm_is_trusted`, `function bpf_lsm_verify_prog`, `function bpf_inode_storage_free`, `function bpf_set_dentry_xattr_locked`, `function bpf_remove_dentry_xattr_locked`, `function bpf_lsm_has_d_inode_locked`, `function bpf_lsm_hook_returns_errno`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.