include/linux/bpf_verifier.h
Source file repositories/reference/linux-study-clean/include/linux/bpf_verifier.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/bpf_verifier.h- Extension
.h- Size
- 51698 bytes
- Lines
- 1612
- 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/bpf.hlinux/btf.hlinux/filter.hlinux/tnum.hlinux/cnum.h
Detected Declarations
struct bpf_reg_statestruct bpf_stack_statestruct bpf_reference_statestruct bpf_retval_rangestruct bpf_func_statestruct bpf_jmp_history_entrystruct bpf_verifier_statestruct bpf_verifier_state_liststruct bpf_loop_inline_statestruct bpf_map_ptr_statestruct bpf_iarraystruct bpf_insn_aux_datastruct bpf_verifier_logstruct bpf_log_attrstruct bpf_subprog_arg_infostruct bpf_subprog_infostruct bpf_verifier_envstruct backtrack_statestruct bpf_id_pairstruct bpf_idmapstruct bpf_idsetstruct bpf_scc_callchainstruct bpf_scc_backedgestruct bpf_scc_visitstruct bpf_scc_infostruct bpf_livenessstruct bpf_verifier_envstruct bpf_call_summarystruct bpf_map_descstruct bpf_dynptr_descstruct ref_obj_descstruct bpf_kfunc_call_arg_metastruct bpf_kfunc_descstruct bpf_kfunc_desc_tabenum bpf_iter_stateenum bpf_stack_slot_typeenum ref_state_typeenum priv_stack_modeenum bpf_reg_arg_typefunction reg_sminfunction reg_smaxfunction reg_uminfunction reg_umaxfunction reg_s32_minfunction reg_s32_maxfunction reg_u32_minfunction reg_u32_maxfunction reg_set_srange32
Annotated Snippet
struct bpf_reg_state {
/* Ordering of fields matters. See states_equal() */
enum bpf_reg_type type;
/*
* Constant delta between "linked" scalars with the same ID.
*/
s32 delta;
union {
/* valid when type == PTR_TO_PACKET */
int range;
/* valid when type == CONST_PTR_TO_MAP | PTR_TO_MAP_VALUE |
* PTR_TO_MAP_VALUE_OR_NULL
*/
struct {
struct bpf_map *map_ptr;
/* To distinguish map lookups from outer map
* the map_uid is non-zero for registers
* pointing to inner maps.
*/
u32 map_uid;
};
/* for PTR_TO_BTF_ID */
struct {
struct btf *btf;
u32 btf_id;
};
struct { /* for PTR_TO_MEM | PTR_TO_MEM_OR_NULL */
u32 mem_size;
};
/* For dynptr stack slots */
struct {
enum bpf_dynptr_type type;
/* A dynptr is 16 bytes so it takes up 2 stack slots.
* We need to track which slot is the first slot
* to protect against cases where the user may try to
* pass in an address starting at the second slot of the
* dynptr.
*/
bool first_slot;
} dynptr;
/* For bpf_iter stack slots */
struct {
/* BTF container and BTF type ID describing
* struct bpf_iter_<type> of an iterator state
*/
struct btf *btf;
u32 btf_id;
/* packing following two fields to fit iter state into 16 bytes */
enum bpf_iter_state state:2;
int depth:30;
} iter;
/* For irq stack slots */
struct {
enum {
IRQ_NATIVE_KFUNC,
IRQ_LOCK_KFUNC,
} kfunc_class;
} irq;
/* Max size from any of the above. */
struct {
unsigned long raw1;
unsigned long raw2;
} raw;
u32 subprogno; /* for PTR_TO_FUNC */
};
/* For scalar types (SCALAR_VALUE), this represents our knowledge of
* the actual value.
* For pointer types, this represents the variable part of the offset
* from the pointed-to object, and is shared with all bpf_reg_states
* with the same id as us.
*/
struct tnum var_off;
/* Used to determine if any memory access using this register will
* result in a bad access.
* These refer to the same value as var_off, not necessarily the actual
* contents of the register.
*/
struct cnum64 r64; /* 64-bit range as circular number */
struct cnum32 r32; /* 32-bit range as circular number */
/* For PTR_TO_PACKET, used to find other pointers with the same variable
* offset, so they can share range knowledge.
* For PTR_TO_MAP_VALUE_OR_NULL this is used to share which map value we
Annotation
- Immediate include surface: `linux/bpf.h`, `linux/btf.h`, `linux/filter.h`, `linux/tnum.h`, `linux/cnum.h`.
- Detected declarations: `struct bpf_reg_state`, `struct bpf_stack_state`, `struct bpf_reference_state`, `struct bpf_retval_range`, `struct bpf_func_state`, `struct bpf_jmp_history_entry`, `struct bpf_verifier_state`, `struct bpf_verifier_state_list`, `struct bpf_loop_inline_state`, `struct bpf_map_ptr_state`.
- 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.