On Fri, Feb 10, 2023 at 02:24:13PM +0100, Kumar Kartikeya Dwivedi wrote: > > [...] > > +static void invalidate_non_owning_refs(struct bpf_verifier_env *env, > > + struct bpf_active_lock *lock) > > +{ > > + struct bpf_func_state *unused; > > + struct bpf_reg_state *reg; > > + > > + bpf_for_each_reg_in_vstate(env->cur_state, unused, reg, ({ > > + if (reg->non_owning_ref_lock.ptr && > > + reg->non_owning_ref_lock.ptr == lock->ptr && > > + reg->non_owning_ref_lock.id == lock->id) > > + __mark_reg_unknown(env, reg); > > Probably better to do: > > if (!env->allow_ptr_leaks) > __mark_reg_not_init(...); > else > __mark_reg_unknown(...); That's redundant. kfuncs and any PTR_TO_BTF_ID access requires allow_ptr_leaks. See first check in check_ptr_to_btf_access()