Skip to content

Commit

Permalink
Skip kprobing bpf progs for --filter-track-bpf-helpers
Browse files Browse the repository at this point in the history
It's to avoid the following log:

```bash
 ./pwru --filter-track-bpf-helpers --filter-trace-tc --filter-func '.*udp.*' --output-limit-lines 10 icmp
2024/10/08 13:21:03 Attaching tc-bpf progs...
2024/10/08 13:21:04 Opening non-skb-kprobe bpf_prog_0b3a2ce7164b50f3_fentry_tc[bpf]: symbol 'bpf_prog_0b3a2ce7164b50f3_fentry_tc[bpf]' must be a valid symbol in /proc/kallsyms: invalid input
2024/10/08 13:21:04 Opening non-skb-kprobe bpf_prog_0ca2b1941f84fe9b_fexit_tc[bpf]: symbol 'bpf_prog_0ca2b1941f84fe9b_fexit_tc[bpf]' must be a valid symbol in /proc/kallsyms: invalid input
2024/10/08 13:21:04 Opening non-skb-kprobe bpf_prog_f9e178771bf9c08b_subprog1[bpf]: symbol 'bpf_prog_f9e178771bf9c08b_subprog1[bpf]' must be a valid symbol in /proc/kallsyms: invalid input
2024/10/08 13:21:04 Opening non-skb-kprobe bpf_prog_f9e178771bf9c08b_subprog2[bpf]: symbol 'bpf_prog_f9e178771bf9c08b_subprog2[bpf]' must be a valid symbol in /proc/kallsyms: invalid input
2024/10/08 13:21:04 Opening non-skb-kprobe bpf_prog_f9e178771bf9c08b_subprog3[bpf]: symbol 'bpf_prog_f9e178771bf9c08b_subprog3[bpf]' must be a valid symbol in /proc/kallsyms: invalid input
```

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
  • Loading branch information
Asphaltt authored and brb committed Oct 13, 2024
1 parent 5455e74 commit 195950a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/pwru/kprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"log"
"os"
"slices"
"strings"
"sync"
"syscall"

Expand Down Expand Up @@ -257,6 +258,11 @@ func NewNonSkbFuncsKprober(nonSkbFuncs []string, funcs Funcs, coll *ebpf.Collect
continue
}

if strings.HasSuffix(fn, "[bpf]") {
// Skip bpf progs
continue
}

kp, err := link.Kprobe(fn, coll.Programs["kprobe_skb_by_stackid"], nil)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
Expand Down

0 comments on commit 195950a

Please sign in to comment.