Open
Conversation
Contributor
Author
|
Note that the runtime library functions in |
Contributor
Author
|
Also: IBT support is for 64-bit x86 only. Intel processors support IBT in 32-bit mode as well, but I don't think it's worth supporting in CompCert. |
Contributor
|
Note: we also support this (on AArch64 and x86) in Chamois. https://gricad-gitlab.univ-grenoble-alpes.fr/certicompil/Chamois-CompCert |
This file contains hidden or 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
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.
This PR adds support for IBT, a control-flow integrity mechanism in the x86 architecture. It adds
endbr64instructions at function entry points, so that they can be called via a pointer, and anotrackprefix for jumps through jump tables.These instructions are generated if the
-fcf-protection=branchoption is given on the command-line. On BSD systems,-fcf-protection=branchis the default and-fcf-protection=nonecan be given to turn IBT off.If
-fcf-protection=branchis given, appropriate ELF annotations are added to object files so that the Linux linker and loader can activate IBT at run-time if all object files have been compiled with-fcf-protection=branch. (OpenBSD ignores this annotation and activates IBT by default, except if the program was linked with-z nobtcfi.)Few Intel processors and no AMD processors support IBT in hardware. On other processors, the special IBT instructions are treated like NOPs. I have not been able to test that this PR actually implements IBT. I just tested that the generated code works fine on non-IBT-enabled processors and carries the ELF annotations that Linux expects.
Fixes: #556.