-
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 loses ctx and confuses verifier #235
Comments
Just looked at verifier part. after 5: (07) r1 += 48, r1 will be marked as UNKNOWN_VALUE, so later on, insn #7, "r2 + 0" is and verifier will fail. There is a source code workaround, and compiler could do it: yhs@ubuntu:~/work/bcc/examples$ cat ex3.py from bcc import BPF load BPF programb = BPF(text = """ from 3 to 5: safe yhs@ubuntu:~/work/bcc/examples$ Fixing verifier will require some effort: yhs@ubuntu:~/work/bcc/examples$ sudo ./ex2.py The value "r2" in insn #7 could be come from two places, insn #1 and insn #6. Besides to remember "ctx + offset", some control flow/basic block concept may be needed, and this may introduce a lot more complexity... On Fri, Sep 18, 2015 at 3:49 PM, Brenden Blanco [email protected]
|
Source code is:
The issue is clearly that LLVM introduced an optimization that incremented r1 conditionally rather than letting it stay as original r1 value and loading from r1 +40/48. I will investigate which compiler pass moved this value, meanwhile @yonghong-song agreed to look at the verifier side.
The text was updated successfully, but these errors were encountered: