tools/testing/selftests/bpf/prog_tests/verifier.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/verifier.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/verifier.c- Extension
.c- Size
- 15791 bytes
- Lines
- 327
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.hcap_helpers.hverifier_align.skel.hverifier_and.skel.hverifier_arena.skel.hverifier_arena_large.skel.hverifier_arena_globals1.skel.hverifier_arena_globals2.skel.hverifier_array_access.skel.hverifier_async_cb_context.skel.hverifier_basic_stack.skel.hverifier_bitfield_write.skel.hverifier_bounds.skel.hverifier_bounds_deduction.skel.hverifier_bounds_deduction_non_const.skel.hverifier_bounds_mix_sign_unsign.skel.hverifier_bpf_get_stack.skel.hverifier_bpf_trap.skel.hverifier_bswap.skel.hverifier_btf_ctx_access.skel.hverifier_btf_unreliable_prog.skel.hverifier_call_large_imm.skel.hverifier_cfg.skel.hverifier_cgroup_inv_retcode.skel.hverifier_cgroup_skb.skel.hverifier_cgroup_storage.skel.hverifier_const.skel.hverifier_const_or.skel.hverifier_ctx.skel.hverifier_ctx_sk_msg.skel.hverifier_d_path.skel.hverifier_default_trusted_ptr.skel.h
Detected Declarations
struct test_valfunction run_tests_auxfunction test_verifier_alignfunction test_verifier_andfunction test_verifier_arenafunction test_verifier_arena_largefunction test_verifier_arena_globals1function test_verifier_arena_globals2function test_verifier_basic_stackfunction test_verifier_bitfield_writefunction test_verifier_boundsfunction test_verifier_bounds_deductionfunction test_verifier_bounds_deduction_non_constfunction test_verifier_bounds_mix_sign_unsignfunction test_verifier_bpf_get_stackfunction test_verifier_bpf_trapfunction test_verifier_bswapfunction test_verifier_btf_ctx_accessfunction test_verifier_btf_unreliable_progfunction test_verifier_call_large_immfunction test_verifier_cfgfunction test_verifier_cgroup_inv_retcodefunction test_verifier_cgroup_skbfunction test_verifier_cgroup_storagefunction test_verifier_constfunction test_verifier_const_orfunction test_verifier_ctxfunction test_verifier_ctx_sk_msgfunction test_verifier_d_pathfunction test_verifier_default_trusted_ptrfunction test_verifier_direct_packet_accessfunction test_verifier_direct_stack_access_wraparoundfunction test_verifier_div0function test_verifier_div_mod_boundsfunction test_verifier_div_overflowfunction test_verifier_flow_keysfunction test_verifier_global_subprogsfunction test_verifier_global_ptr_argsfunction test_verifier_gotolfunction test_verifier_gotoxfunction test_verifier_helper_access_var_lenfunction test_verifier_helper_packet_accessfunction test_verifier_helper_restrictedfunction test_verifier_helper_value_accessfunction test_verifier_int_ptrfunction test_verifier_iterating_callbacksfunction test_verifier_jeq_infer_not_nullfunction test_verifier_jit_convergence
Annotated Snippet
struct test_val {
unsigned int index;
int foo[MAX_ENTRIES];
};
__maybe_unused
static void run_tests_aux(const char *skel_name,
skel_elf_bytes_fn elf_bytes_factory,
pre_execution_cb pre_execution_cb)
{
struct test_loader tester = {};
__u64 old_caps;
int err;
/* test_verifier tests are executed w/o CAP_SYS_ADMIN, do the same here */
err = cap_disable_effective(1ULL << CAP_SYS_ADMIN, &old_caps);
if (err) {
PRINT_FAIL("failed to drop CAP_SYS_ADMIN: %i, %s\n", err, strerror(-err));
return;
}
test_loader__set_pre_execution_cb(&tester, pre_execution_cb);
test_loader__run_subtests(&tester, skel_name, elf_bytes_factory);
test_loader_fini(&tester);
err = cap_enable_effective(old_caps, NULL);
if (err)
PRINT_FAIL("failed to restore CAP_SYS_ADMIN: %i, %s\n", err, strerror(-err));
}
#define RUN(skel) run_tests_aux(#skel, skel##__elf_bytes, NULL)
void test_verifier_align(void) { RUN(verifier_align); }
void test_verifier_and(void) { RUN(verifier_and); }
void test_verifier_arena(void) { RUN(verifier_arena); }
void test_verifier_arena_large(void) { RUN(verifier_arena_large); }
void test_verifier_arena_globals1(void) { RUN(verifier_arena_globals1); }
void test_verifier_arena_globals2(void) { RUN(verifier_arena_globals2); }
void test_verifier_basic_stack(void) { RUN(verifier_basic_stack); }
void test_verifier_bitfield_write(void) { RUN(verifier_bitfield_write); }
void test_verifier_bounds(void) { RUN(verifier_bounds); }
void test_verifier_bounds_deduction(void) { RUN(verifier_bounds_deduction); }
void test_verifier_bounds_deduction_non_const(void) { RUN(verifier_bounds_deduction_non_const); }
void test_verifier_bounds_mix_sign_unsign(void) { RUN(verifier_bounds_mix_sign_unsign); }
void test_verifier_bpf_get_stack(void) { RUN(verifier_bpf_get_stack); }
void test_verifier_bpf_trap(void) { RUN(verifier_bpf_trap); }
void test_verifier_bswap(void) { RUN(verifier_bswap); }
void test_verifier_btf_ctx_access(void) { RUN(verifier_btf_ctx_access); }
void test_verifier_btf_unreliable_prog(void) { RUN(verifier_btf_unreliable_prog); }
void test_verifier_call_large_imm(void) { RUN(verifier_call_large_imm); }
void test_verifier_cfg(void) { RUN(verifier_cfg); }
void test_verifier_cgroup_inv_retcode(void) { RUN(verifier_cgroup_inv_retcode); }
void test_verifier_cgroup_skb(void) { RUN(verifier_cgroup_skb); }
void test_verifier_cgroup_storage(void) { RUN(verifier_cgroup_storage); }
void test_verifier_const(void) { RUN(verifier_const); }
void test_verifier_const_or(void) { RUN(verifier_const_or); }
void test_verifier_ctx(void) { RUN_TESTS(verifier_ctx); }
void test_verifier_ctx_sk_msg(void) { RUN(verifier_ctx_sk_msg); }
void test_verifier_d_path(void) { RUN(verifier_d_path); }
void test_verifier_default_trusted_ptr(void) { RUN_TESTS(verifier_default_trusted_ptr); }
void test_verifier_direct_packet_access(void) { RUN(verifier_direct_packet_access); }
void test_verifier_direct_stack_access_wraparound(void) { RUN(verifier_direct_stack_access_wraparound); }
void test_verifier_div0(void) { RUN(verifier_div0); }
void test_verifier_div_mod_bounds(void) { RUN(verifier_div_mod_bounds); }
void test_verifier_div_overflow(void) { RUN(verifier_div_overflow); }
void test_verifier_flow_keys(void) { RUN(verifier_flow_keys); }
void test_verifier_global_subprogs(void) { RUN(verifier_global_subprogs); }
void test_verifier_global_ptr_args(void) { RUN(verifier_global_ptr_args); }
void test_verifier_gotol(void) { RUN(verifier_gotol); }
void test_verifier_gotox(void) { RUN(verifier_gotox); }
void test_verifier_helper_access_var_len(void) { RUN(verifier_helper_access_var_len); }
void test_verifier_helper_packet_access(void) { RUN(verifier_helper_packet_access); }
void test_verifier_helper_restricted(void) { RUN(verifier_helper_restricted); }
void test_verifier_helper_value_access(void) { RUN(verifier_helper_value_access); }
void test_verifier_int_ptr(void) { RUN(verifier_int_ptr); }
void test_verifier_iterating_callbacks(void) { RUN(verifier_iterating_callbacks); }
void test_verifier_jeq_infer_not_null(void) { RUN(verifier_jeq_infer_not_null); }
void test_verifier_jit_convergence(void) { RUN(verifier_jit_convergence); }
void test_verifier_load_acquire(void) { RUN(verifier_load_acquire); }
void test_verifier_ld_ind(void) { RUN(verifier_ld_ind); }
void test_verifier_ldsx(void) { RUN(verifier_ldsx); }
void test_verifier_leak_ptr(void) { RUN(verifier_leak_ptr); }
void test_verifier_linked_scalars(void) { RUN(verifier_linked_scalars); }
void test_verifier_live_stack(void) { RUN(verifier_live_stack); }
void test_verifier_liveness_exp(void) { RUN(verifier_liveness_exp); }
void test_verifier_loops1(void) { RUN(verifier_loops1); }
void test_verifier_lwt(void) { RUN(verifier_lwt); }
void test_verifier_map_in_map(void) { RUN(verifier_map_in_map); }
void test_verifier_map_ptr(void) { RUN(verifier_map_ptr); }
void test_verifier_map_ptr_mixing(void) { RUN(verifier_map_ptr_mixing); }
Annotation
- Immediate include surface: `test_progs.h`, `cap_helpers.h`, `verifier_align.skel.h`, `verifier_and.skel.h`, `verifier_arena.skel.h`, `verifier_arena_large.skel.h`, `verifier_arena_globals1.skel.h`, `verifier_arena_globals2.skel.h`.
- Detected declarations: `struct test_val`, `function run_tests_aux`, `function test_verifier_align`, `function test_verifier_and`, `function test_verifier_arena`, `function test_verifier_arena_large`, `function test_verifier_arena_globals1`, `function test_verifier_arena_globals2`, `function test_verifier_basic_stack`, `function test_verifier_bitfield_write`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.