Re: [PATCH v3 1/2] bpf: Reject attaching fexit to functions annotated with __noreturn

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

--
Regards
Yafang





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux