diff --git a/internal/pwru/bpf_prog.go b/internal/pwru/bpf_prog.go index 425d2e11..dfc4f2a4 100644 --- a/internal/pwru/bpf_prog.go +++ b/internal/pwru/bpf_prog.go @@ -12,6 +12,8 @@ import ( "golang.org/x/sys/unix" ) +var errNotFound = errors.New("not found") + type BpfProgName2Addr map[string]uint64 func listBpfProgs(typ ebpf.ProgramType) ([]*ebpf.Program, error) { @@ -49,7 +51,10 @@ func getEntryFuncName(prog *ebpf.Program) (string, string, error) { id, ok := info.BTFID() if !ok { - return "", "", fmt.Errorf("bpf program %s does not have BTF", info.Name) + // FENTRY/FEXIT program can only be attached to another program + // annotated with BTF. So if the BTF ID is not found, it means + // the program is not annotated with BTF. + return "", "", errNotFound } handle, err := btf.NewHandleFromID(id) diff --git a/internal/pwru/tracing.go b/internal/pwru/tracing.go index c3bda823..341a5681 100644 --- a/internal/pwru/tracing.go +++ b/internal/pwru/tracing.go @@ -66,6 +66,9 @@ func (t *tracing) traceProg(spec *ebpf.CollectionSpec, ) error { entryFn, name, err := getEntryFuncName(prog) if err != nil { + if errors.Is(err, errNotFound) { + return nil + } return fmt.Errorf("failed to get entry function name: %w", err) }