-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
LLVM optimized code triggers error in verifier #2087
Comments
The verifier seems doing the right thing. The issue, the compiler does not One possible way is to check ptr->n_points comparing to MAX_POINTS under which you do the rest of operations. Hopefully, verifier pruning functionality can kick in to permit the write. |
Ho, I see. Actually I saw the trick in https://patchwork.ozlabs.org/patch/664153/ but I did not pick it up. if you code it as follow
Then you will get an error because, if I understand well, we fall into this condition from the BPF doc :
I got around this by separating getting the value from the struct and incrementing the struct member itself later
|
I have a piece of C code where BPF_HASH members are structs with array members:
Accessing the array member triggers a verifier error:
This seems related to #235 or https://patchwork.codeaurora.org/patch/507977/: some optimization mess up the register
r1
given as argument to the call. The offset value becomes the maximum value thatr1<<=3
(which was originally au16
) can take, which is much larger than the value size of the BPF_HASH entries (136 here).Playing around with different ways to set the element results in the same generated code, e.g.:
Am I missing something obvious here? Or is it indeed some conflict between LLVM optimizations and the BPF verifier?
The text was updated successfully, but these errors were encountered: