-
Notifications
You must be signed in to change notification settings - Fork 730
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
Probe kernel bpf2bpf support #657
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
Collaborator
ti-mo
commented
May 4, 2022
•
edited
Loading
edited
- Provide clear(er) and earlier error feedback about the kernel's bpf2bpf support
- Allow test skips when loading a bpf2bpf prog on a kernel that doesn't support it
- Remove hardcoded feature gates for bpf2bpf on kernel 4.16
lmb
requested changes
May 4, 2022
1e0c614
to
162f314
Compare
lmb
reviewed
May 6, 2022
Thanks, checking after loading is nicer! |
Whitespace-trimming a C string using bytes.Trim is ineffective without first trimming the NUL byte(s). [ ... 108 101 32 105 110 115 110 32 50 56 10 0 0 0 ... ] Don't add \x00 to the cutset for performance reasons. Truncate on the first NUL like unix.ByteSliceToString does, then trim the remaining bytes. Signed-off-by: Timo Beckers <timo@isovalent.com>
When trying to load a program containing bpf2bpf calls on a kernel that doesn't support it, we bubble up the verifier error to the caller: program xdp_prog: load program: invalid argument: unreachable insn 28 This is clear, but doesn't allow skipping tests when loading e.g. loader.c on older kernels due to it containing bpf2bpf calls. Implement a feature probe for bpf2bpf, return an unsupported error when trying to load a program with multiple subprogs on an older kernel. Update the test suite to skip unsupported features instead of hardcoding a skip on 4.16 and earlier. Signed-off-by: Timo Beckers <timo@isovalent.com>
If a program has function references, return ErrNotSupported if program creation fails and we know the kernel doesn't support bpf2bpf calls, or if the user is unprivileged. Signed-off-by: Timo Beckers <timo@isovalent.com>
lmb
approved these changes
May 10, 2022
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.
Looks good, thanks for looking at ErrorWithLog as well
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.