On Wed, Feb 26, 2025 at 2:39 AM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > On Mon, Feb 24, 2025 at 11:35 PM Yafang Shao <laoar.shao@xxxxxxxxx> wrote: > > > > On Tue, Feb 25, 2025 at 1:30 AM Alexei Starovoitov > > <alexei.starovoitov@xxxxxxxxx> wrote: > > > > > > On Mon, Feb 24, 2025 at 3:46 AM Yafang Shao <laoar.shao@xxxxxxxxx> wrote: > > > > > > > > + } else if (prog->expected_attach_type == BPF_TRACE_FEXIT && > > > > + btf_id_set_contains(&fexit_deny, btf_id)) { > > > > + verbose(env, "Attaching fexit to __noreturn functions is rejected.\n"); > > > > + return -EINVAL; > > > > > > Just realized that this needs to include > > > prog->expected_attach_type == BPF_MODIFY_RETURN > > > since it's doing __bpf_tramp_enter() too. > > > > I will add it. > > > > > > > > Also the list must only contain existing functions. > > > Otherwise there are plenty of build warns: > > > BTFIDS vmlinux > > > WARN: resolve_btfids: unresolved symbol xen_start_kernel > > > WARN: resolve_btfids: unresolved symbol xen_cpu_bringup_again > > > WARN: resolve_btfids: unresolved symbol usercopy_abort > > > WARN: resolve_btfids: unresolved symbol snp_abort > > > WARN: resolve_btfids: unresolved symbol sev_es_terminate > > > WARN: resolve_btfids: unresolved symbol rust_helper_BUG > > > ... > > > > I missed these warnings. > > It looks like we need to add "#ifdef XXXX" to each function. > > Alternatively, could we just compare the function name with > > prog->aux->attach_func_name instead? > > Strings are much less efficient than btf_ids. > Especially comparing across many strings. > To minimize ifdef-s lets remove all functions that bpf cannot > attach anyway (that are not in available_filter_functions). > Then drop all that call panic/BUG equivalent, > since refcnt on trampoline is irrelevant at that point. > That will remove even more functions. > At the end the list will be short with few ifdef-s. > This is a temporary workaround anyway, so let's not get too creative. Understood -- Regards Yafang