On Tue, Nov 23, 2021 at 10:02 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > + > + /* Attempt to find target candidates in vmlinux BTF first */ > + main_btf = bpf_get_btf_vmlinux(); > + cands = bpf_core_add_cands(cands, main_btf, 1); > + if (IS_ERR(cands)) > + return cands; > + > + /* populate cache even when cands->cnt == 0 */ > + populate_cand_cache(cands, vmlinux_cand_cache, VMLINUX_CAND_CACHE_SIZE); > + > + /* if vmlinux BTF has any candidate, don't go for module BTFs */ > + if (cands->cnt) > + return cands; > + > +check_modules: > + cc = check_cand_cache(cands, module_cand_cache, MODULE_CAND_CACHE_SIZE); > + if (cc) { > + bpf_free_cands(cands); > + /* if cache has it return it even if cc->cnt == 0 */ > + return cc; > + } Found another issue in the above: When cache is populated with empty cands the above free_cands() will make it uaf. Fixing in respin.