-
Notifications
You must be signed in to change notification settings - Fork 14k
[RISC-V] Adjust trampoline code for branch control flow protection #141949
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
Conversation
@llvm/pr-subscribers-backend-risc-v Author: Jesse Huang (jaidTw) ChangesIt is tricky to observe the trampoline code from the lit test file, because instructions are encoded and written onto the stack
|
There is a change to use software-guarded jump (t2) in the trampoline code, the new stack of the test is now
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
5782af0
to
c3de1c7
Compare
Is gcc going to make the same change? |
Yes, They plan to change it but might not landed yet. @kito-cheng should know more |
CI is failing on the new test, but I can't reproduce it locally yet |
Yes, the code sequence used in GCC was designed for our internal fixed-one label scheme, that's not work for func-sig based scheme, so the only way is using sw-guarded jump here I think. |
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.
LGTM. Thanks @jaidTw !
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/13857 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/12469 Here is the relevant piece of the build log for the reference
|
…lvm#141949) Trampoline will use a alternative sequence when branch CFI is on. The stack of the test is organized as follow ``` 56 $ra 44 $a0 f 36 $a1 p 32 00038067 jalr t2 28 010e3e03 ld t3, 16(t3) 24 018e3383 ld t2, 24(t3) 20 00000e17 auipc t3, 0 sp+16 00000023 lpad 0 ```
…lvm#141949) Trampoline will use a alternative sequence when branch CFI is on. The stack of the test is organized as follow ``` 56 $ra 44 $a0 f 36 $a1 p 32 00038067 jalr t2 28 010e3e03 ld t3, 16(t3) 24 018e3383 ld t2, 24(t3) 20 00000e17 auipc t3, 0 sp+16 00000023 lpad 0 ```
…lvm#141949) Trampoline will use a alternative sequence when branch CFI is on. The stack of the test is organized as follow ``` 56 $ra 44 $a0 f 36 $a1 p 32 00038067 jalr t2 28 010e3e03 ld t3, 16(t3) 24 018e3383 ld t2, 24(t3) 20 00000e17 auipc t3, 0 sp+16 00000023 lpad 0 ```
It is tricky to observe the trampoline code in the lit test file because instructions are encoded and written onto the stack. I don't have a better idea for doing it now. The stack of the test is organized as follow