Skip to content

Commit 195950a

Browse files
Asphalttbrb
authored andcommitted
Skip kprobing bpf progs for --filter-track-bpf-helpers
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 <[email protected]>
1 parent 5455e74 commit 195950a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/pwru/kprobe.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"log"
1111
"os"
1212
"slices"
13+
"strings"
1314
"sync"
1415
"syscall"
1516

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

261+
if strings.HasSuffix(fn, "[bpf]") {
262+
// Skip bpf progs
263+
continue
264+
}
265+
260266
kp, err := link.Kprobe(fn, coll.Programs["kprobe_skb_by_stackid"], nil)
261267
if err != nil {
262268
if errors.Is(err, os.ErrNotExist) {

0 commit comments

Comments
 (0)