#ifndef _LINUX_BPF_VERIFIER_H
#define _LINUX_BPF_VERIFIER_H …
#include <linux/bpf.h>
#include <linux/btf.h>
#include <linux/filter.h>
#include <linux/tnum.h>
#define BPF_MAX_VAR_OFF …
#define BPF_MAX_VAR_SIZ …
#define TMP_STR_BUF_LEN …
#define INSN_BUF_SIZE …
enum bpf_reg_liveness { … };
struct bpf_active_lock { … };
#define ITER_PREFIX …
enum bpf_iter_state { … };
struct bpf_reg_state { … };
enum bpf_stack_slot_type { … };
#define BPF_REG_SIZE …
#define BPF_REGMASK_ARGS …
#define BPF_DYNPTR_SIZE …
#define BPF_DYNPTR_NR_SLOTS …
struct bpf_stack_state { … };
struct bpf_reference_state { … };
struct bpf_retval_range { … };
struct bpf_func_state { … };
#define MAX_CALL_FRAMES …
enum { … };
static_assert(…);
static_assert(…);
struct bpf_jmp_history_entry { … };
#define BPF_ID_MAP_SIZE …
struct bpf_verifier_state { … };
#define bpf_get_spilled_reg(slot, frame, mask) …
#define bpf_for_each_spilled_reg(iter, frame, reg, mask) …
#define bpf_for_each_reg_in_vstate_mask(__vst, __state, __reg, __mask, __expr) …
#define bpf_for_each_reg_in_vstate(__vst, __state, __reg, __expr) …
struct bpf_verifier_state_list { … };
struct bpf_loop_inline_state { … };
struct bpf_map_ptr_state { … };
#define BPF_ALU_SANITIZE_SRC …
#define BPF_ALU_SANITIZE_DST …
#define BPF_ALU_NEG_VALUE …
#define BPF_ALU_NON_POINTER …
#define BPF_ALU_IMMEDIATE …
#define BPF_ALU_SANITIZE …
struct bpf_insn_aux_data { … };
#define MAX_USED_MAPS …
#define MAX_USED_BTFS …
#define BPF_VERIFIER_TMP_LOG_SIZE …
struct bpf_verifier_log { … };
#define BPF_LOG_LEVEL1 …
#define BPF_LOG_LEVEL2 …
#define BPF_LOG_STATS …
#define BPF_LOG_FIXED …
#define BPF_LOG_LEVEL …
#define BPF_LOG_MASK …
#define BPF_LOG_KERNEL …
#define BPF_LOG_MIN_ALIGNMENT …
#define BPF_LOG_ALIGNMENT …
static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log)
{ … }
#define BPF_MAX_SUBPROGS …
struct bpf_subprog_arg_info { … };
struct bpf_subprog_info { … };
struct bpf_verifier_env;
struct backtrack_state { … };
struct bpf_id_pair { … };
struct bpf_idmap { … };
struct bpf_idset { … };
struct bpf_verifier_env { … };
static inline struct bpf_func_info_aux *subprog_aux(struct bpf_verifier_env *env, int subprog)
{ … }
static inline struct bpf_subprog_info *subprog_info(struct bpf_verifier_env *env, int subprog)
{ … }
__printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log,
const char *fmt, va_list args);
__printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env,
const char *fmt, ...);
__printf(2, 3) void bpf_log(struct bpf_verifier_log *log,
const char *fmt, ...);
int bpf_vlog_init(struct bpf_verifier_log *log, u32 log_level,
char __user *log_buf, u32 log_size);
void bpf_vlog_reset(struct bpf_verifier_log *log, u64 new_pos);
int bpf_vlog_finalize(struct bpf_verifier_log *log, u32 *log_size_actual);
__printf(3, 4) void verbose_linfo(struct bpf_verifier_env *env,
u32 insn_off,
const char *prefix_fmt, ...);
static inline struct bpf_func_state *cur_func(struct bpf_verifier_env *env)
{ … }
static inline struct bpf_reg_state *cur_regs(struct bpf_verifier_env *env)
{ … }
int bpf_prog_offload_verifier_prep(struct bpf_prog *prog);
int bpf_prog_offload_verify_insn(struct bpf_verifier_env *env,
int insn_idx, int prev_insn_idx);
int bpf_prog_offload_finalize(struct bpf_verifier_env *env);
void
bpf_prog_offload_replace_insn(struct bpf_verifier_env *env, u32 off,
struct bpf_insn *insn);
void
bpf_prog_offload_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt);
static inline u64 bpf_trampoline_compute_key(const struct bpf_prog *tgt_prog,
struct btf *btf, u32 btf_id)
{ … }
static inline void bpf_trampoline_unpack_key(u64 key, u32 *obj_id, u32 *btf_id)
{ … }
int bpf_check_attach_target(struct bpf_verifier_log *log,
const struct bpf_prog *prog,
const struct bpf_prog *tgt_prog,
u32 btf_id,
struct bpf_attach_target_info *tgt_info);
void bpf_free_kfunc_btf_tab(struct bpf_kfunc_btf_tab *tab);
int mark_chain_precision(struct bpf_verifier_env *env, int regno);
#define BPF_BASE_TYPE_MASK …
static inline u32 base_type(u32 type)
{ … }
static inline u32 type_flag(u32 type)
{ … }
static inline enum bpf_prog_type resolve_prog_type(const struct bpf_prog *prog)
{ … }
static inline bool bpf_prog_check_recur(const struct bpf_prog *prog)
{ … }
#define BPF_REG_TRUSTED_MODIFIERS …
static inline bool bpf_type_has_unsafe_modifiers(u32 type)
{ … }
static inline bool type_is_ptr_alloc_obj(u32 type)
{ … }
static inline bool type_is_non_owning_ref(u32 type)
{ … }
static inline bool type_is_pkt_pointer(enum bpf_reg_type type)
{ … }
static inline bool type_is_sk_pointer(enum bpf_reg_type type)
{ … }
static inline bool type_may_be_null(u32 type)
{ … }
static inline void mark_reg_scratched(struct bpf_verifier_env *env, u32 regno)
{ … }
static inline void mark_stack_slot_scratched(struct bpf_verifier_env *env, u32 spi)
{ … }
static inline bool reg_scratched(const struct bpf_verifier_env *env, u32 regno)
{ … }
static inline bool stack_slot_scratched(const struct bpf_verifier_env *env, u64 regno)
{ … }
static inline bool verifier_state_scratched(const struct bpf_verifier_env *env)
{ … }
static inline void mark_verifier_state_clean(struct bpf_verifier_env *env)
{ … }
static inline void mark_verifier_state_scratched(struct bpf_verifier_env *env)
{ … }
static inline bool bpf_stack_narrow_access_ok(int off, int fill_size, int spill_size)
{ … }
const char *reg_type_str(struct bpf_verifier_env *env, enum bpf_reg_type type);
const char *dynptr_type_str(enum bpf_dynptr_type type);
const char *iter_type_str(const struct btf *btf, u32 btf_id);
const char *iter_state_str(enum bpf_iter_state state);
void print_verifier_state(struct bpf_verifier_env *env,
const struct bpf_func_state *state, bool print_all);
void print_insn_state(struct bpf_verifier_env *env, const struct bpf_func_state *state);
#endif