-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
x86-retpoline flag (target modifier) to enable retpoline-related target features #135927
base: master
Are you sure you want to change the base?
Conversation
rustbot has assigned @compiler-errors. Use |
Some changes occurred in compiler/rustc_codegen_gcc |
e808e83
to
12b286f
Compare
This comment has been minimized.
This comment has been minimized.
r? compiler |
☔ The latest upstream changes (presumably #136085) made this pull request unmergeable. Please resolve the merge conflicts. |
12b286f
to
f331c60
Compare
This comment has been minimized.
This comment has been minimized.
f331c60
to
434a25f
Compare
This comment has been minimized.
This comment has been minimized.
434a25f
to
945d0f1
Compare
This comment has been minimized.
This comment has been minimized.
r? compiler |
945d0f1
to
0ea46d2
Compare
This comment has been minimized.
This comment has been minimized.
r? compiler |
0ea46d2
to
386c90e
Compare
r? @davidtwco maybe 😅 |
I don't think retpoline actually changes the ABI, so it might not need to be a target modifier. On the other hand, as an exploit mitigation, we do still want to avoid cases where you don't enable the mitigation in every compilation unit. cc @andyhhp do I understand things correctly? |
I read your post in #116852:
That's why I thought it should be a target modifier. |
It's important to distinguish the general retpoline is the specifically transform of an indirect call/jmp instruction into a The need to rewrite the return address on the stack necessitates the use of a GPR, and this is observable call/jmp-ee but any non-parameter register will do, so it doesn't impact the main function call ABI. Even within retpoline itself, there are variations; inline retpolines are an option, but tend to be heavy on the code bloat side, which is why out-of-line retpolines in common sections are often preferred. The alternatives to repoline are As to separate complication units, you can mix and match, but if any one piece of your whole process isn't taking safety precautions, then you've lost. |
-Zx86-retpoline
flag is target modifier (tracked to be equal in linked crates). And so, this PR is dependent from #133138.Enables target features:
+retpoline-external-thunk, +retpoline-indirect-branches, +retpoline-indirect-calls
.Also this PR forbids to specify those target features manually (warning).