mallya's blog

Cooking into the eBPF verifier

In Progress

19 Mar 2026 · Varun R Mallya · BPF, Kernel, fundamentals, verifier

The goal

Rn, we gotta understand the working of the verifier and hopefully find errors.

bpf_check

This is the holy grail where it all starts.

	env->allow_ptr_leaks = bpf_allow_ptr_leaks(env->prog->aux->token);
	env->allow_uninit_stack = bpf_allow_uninit_stack(env->prog->aux->token);
	env->bypass_spec_v1 = bpf_bypass_spec_v1(env->prog->aux->token);
	env->bypass_spec_v4 = bpf_bypass_spec_v4(env->prog->aux->token);
	env->bpf_capable = is_priv = bpf_token_capable(env->prog->aux->token, CAP_BPF);

	/* bit mask to keep track of whether a register has been accessed
	 * since the last time the function state was printed
	 */
	u32 scratched_regs;
	/* Same as scratched_regs but for stack slots */
	u64 scratched_stack_slots;

NOTE:

This blog, like all the blogs in this series is dynamic. It will keep being updated. This article is a stub.