-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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] improve error handling by custom lowering & fail() #75088
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
Also CC @4ast |
Currently on mcpu=v3 we do not support sdiv, srem instructions. And the backend crashes with stacktrace & coredump, which is misleading for end users, as this is not a "bug" Add llvm bug reporting for sdiv/srem on ISel legalize-op phase. For clang frontend we can get detailed location & bug report. $ build/bin/clang -g -target bpf -c local/sdiv.c local/sdiv.c:1:35: error: unsupported signed division, please convert to unsigned div/mod. 1 | int sdiv(int a, int b) { return a / b; } | ^ 1 error generated. Fixes: #70433 Fixes: #48647 This also improves error handling for dynamic stack allocation: local/vla.c:2:3: error: unsupported dynamic stack allocation 2 | int b[n]; | ^ 1 error generated. Fixes: #57171
inclyc
force-pushed
the
users/inclyc/bpf-dont-crash-sdiv-srem
branch
from
December 12, 2023 10:10
1cc86c2
to
63661ff
Compare
inclyc
changed the title
[BPF] improve error handling for unsupported sdiv, srem
[BPF] improve error handling by custom lowering & fail()
Dec 12, 2023
Hi @inclyc, thank you for working on this. I think these chages are fine.
|
eddyz87
approved these changes
Dec 12, 2023
eddyz87
reviewed
Dec 12, 2023
jrguzman-ms
pushed a commit
to msft-mirror-aosp/platform.external.bcc
that referenced
this pull request
Feb 1, 2024
Bug: b/308826679 Context: llvm/llvm-project#75088 Also opened an issue upstream: iovisor/bcc#4896 Change-Id: Ia8650571dc8ba85238333f18c8e0f9b08e40f8f9
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.
Currently on mcpu=v3 we do not support sdiv, srem instructions. And the backend crashes with stacktrace & coredump, which is misleading for end users, as this is not a "bug"
Add llvm bug reporting for sdiv/srem on ISel legalize-op phase.
For clang frontend we can get detailed location & bug report.
Fixes: #70433
Fixes: #48647
This also improves error handling for dynamic stack allocation:
Fixes: #57171