-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: Remove OUTPUT_SKB&HAS_KPROBE_MULTI macros #455
Merged
Merged
Conversation
This file contains 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
Asphaltt
force-pushed
the
feat/simplify-build
branch
from
November 10, 2024 06:06
5b56b72
to
3a05678
Compare
Asphaltt
changed the title
bpf: Remove unnecessary OUTPUT_SKB macro
bpf: Remove OUTPUT_SKB&HAS_KPROBE_MULTI macros
Nov 10, 2024
Asphaltt
force-pushed
the
feat/simplify-build
branch
from
November 10, 2024 07:24
2571b11
to
3d447f8
Compare
Just for the record:
|
Asphaltt
force-pushed
the
feat/simplify-build
branch
2 times, most recently
from
November 12, 2024 14:57
f93ebd2
to
194dbff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always love to see code simplification! Left some comments to discuss.
Asphaltt
force-pushed
the
feat/simplify-build
branch
from
November 13, 2024 15:19
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 <hffilwlqm@gmail.com>
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 <hffilwlqm@gmail.com>
Simplify bpf code. And use Go to determine loading kprobe or kprobe.multi bpf prog. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
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 <hffilwlqm@gmail.com>
Asphaltt
force-pushed
the
feat/simplify-build
branch
from
November 13, 2024 15:21
2ca47fc
to
34fcd87
Compare
brb
approved these changes
Nov 19, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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.