bpf: Remove OUTPUT_SKB&HAS_KPROBE_MULTI macros#455
Merged
brb merged 4 commits intocilium:mainfrom Nov 19, 2024
Merged
Conversation
5b56b72 to
3a05678
Compare
2571b11 to
3d447f8
Compare
Member
|
Just for the record:
|
f93ebd2 to
194dbff
Compare
Member
jschwinger233
left a comment
There was a problem hiding this comment.
Always love to see code simplification! Left some comments to discuss.
194dbff to
2ca47fc
Compare
It's to avoid the following issue for next commit, especially on Ubuntu 20.04: ; instruction poisoned by CO-RE 938: (85) call unknown#195896080 invalid func unknown#195896080 processed 519 insns (limit 1000000) max_states_per_insn 0 total_states 29 peak_states 29 mark_read 27 Signed-off-by: Leon Hwang <[email protected]>
When call set_skb_btf() or set_shinfo_btf(), these functions are protected by constant CFG. Then, while loading kprobe_pwru into kernel, if no --output-skb/--output-skb-shared-info, set_skb_btf()/set_shinfo_btf() won't be verified. Next, these unreachable code will be eliminated by verifier. Signed-off-by: Leon Hwang <[email protected]>
Simplify bpf code. And use Go to determine loading kprobe or kprobe.multi bpf prog. Signed-off-by: Leon Hwang <[email protected]>
Fix this panic: $ sudo ./pwru --output-tuple 'dst host 1.0.0.1 and port 8080' 2024/11/12 13:58:41 Attaching kprobes (via kprobe)... 102 / 1255 [---------->_________________________________________________________________________________________________________________________] 8.13% 96 p/s 231 / 1255 [----------------------->__________________________________________________________________________________________________________] 18.41% 120 p/s 2024/11/12 13:58:43 Listening for events.. SKB CPU PROCESS NETNS MARK/x IFACE PROTO MTU LEN TUPLE FUNC 2024/11/12 13:58:43 Received signal, exiting program.. 2024/11/12 13:58:43 Detaching kprobes... panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x6675d8] goroutine 1 [running]: github.com/cilium/pwru/internal/pwru.(*kprober).DetachKprobes(0x0) /root/Projects/leonhwang/pwru/internal/pwru/kprobe.go:130 +0xb8 main.main() /root/Projects/leonhwang/pwru/main.go:322 +0x2013 Signed-off-by: Leon Hwang <[email protected]>
2ca47fc to
34fcd87
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.
When call set_skb_btf() or set_shinfo_btf(), these functions are protected by constant CFG.
Then, while loading kprobe_pwru into kernel, if no --output-skb/--output-skb-shared-info, set_skb_btf()/set_shinfo_btf() won't be verified. Next, these unreachable code will be eliminated by verifier.