Fix broken --filter-trace-xdp caused by go-ebpf v0.17.1#484
Merged
brb merged 1 commit intocilium:mainfrom Jan 30, 2025
Merged
Conversation
This was referenced Jan 17, 2025
ti-mo
reviewed
Jan 22, 2025
There're two issue: One is `BPF_PROG_ADDR` must be set via `spec.Variable`. Another one is `.bss` map flag must be updated because go-ebpf v0.17.1 set `BPF_F_MMAPABLE` flag to created `.bss` map. As a result, we can reuse `.bss` map. Here's the test result: ```bash $ sudo ./pwru --filter-trace-tc --filter-trace-xdp --filter-func '.*icmp.*' icmp 2025/01/15 15:14:26 Attaching tc-bpf progs... 2025/01/15 15:14:26 Attaching xdp progs... 2025/01/15 15:14:26 Attaching kprobes (via kprobe)... 29 / 29 [--------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s 2025/01/15 15:14:26 Attached (ignored 0) 2025/01/15 15:14:26 Listening for events.. SKB CPU PROCESS NETNS MARK/x IFACE PROTO MTU LEN __sk_buff->cb[] TUPLE FUNC 0xffffb5dd40600b00 6 <empty>:0 4026531840 0 ens33:2 0x0000 1500 98 [0x00000000,0x00000000,0x00000000,0x00000000,0x00000000] 192.168.241.1:0->192.168.241.133:0(icmp) bpf_prog_3b185187f1855c4c_dummy[bpf](xdp) 0xffff995b7756d400 6 <empty>:0 4026531840 0 ens33:2 0x0800 1500 98 [0x00000000,0x00000000,0x00000000,0x00000000,0x00000000] 192.168.241.1:0->192.168.241.133:0(icmp) bpf_prog_e20a685998fd41c8_entry1[bpf](tc) 0xffff995b7756d400 6 <empty>:0 4026531840 0 ens33:2 0x0800 65536 64 [0x00000000,0x00000000,0x00000000,0x00000000,0x00000000] 192.168.241.1:0->192.168.241.133:0(icmp) icmp_rcv 0xffff995b7756d400 6 <empty>:0 4026531840 0 ens33:2 0x0800 65536 56 [0x00000000,0x00000000,0x00000000,0x00000000,0x00000000] 192.168.241.1:0->192.168.241.133:0(icmp) icmp_echo 0xffff995b7756d400 6 <empty>:0 4026531840 0 ens33:2 0x0800 65536 56 [0x00000000,0x00000000,0x00000000,0x00000000,0x00000000] 192.168.241.1:0->192.168.241.133:0(icmp) icmp_reply ^C2025/01/15 15:14:30 Received signal, exiting program.. 2025/01/15 15:14:30 Detaching kprobes... 29 / 29 [------------------------------------------------------------------------------------------------------------------------------------] 100.00% 132 p/s ``` And there's only one `.bss` map: ```bash $ sudo bpftool m | grep -c .bss 1 ``` Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
49628ea to
76bdadf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #483
There're two issue:
One is
BPF_PROG_ADDRmust be set viaspec.Variable.Another one is
.bssmap flag must be updated because go-ebpf v0.17.1 setBPF_F_MMAPABLEflag to created.bssmap. As a result, we can reuse.bssmap.Here's the test result:
And there's only one
.bssmap:# bpftool m | grep -c .bss 1