-
Notifications
You must be signed in to change notification settings - Fork 25
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
Implement IBT on amd64 / i386 #173
base: main
Are you sure you want to change the base?
Conversation
Alternatively, I can introduce
in |
Thank you for addressing this whole issue, which as far as I know had passed us by completely. We should probably be doing more testing on BSD versions! Your solution seems to be a nice lightweight one in the sense that the additional ENDBR instructions are only added with Of course, it is unfortunate that the proofs in principle don't cover the CET-enabled variants. We could adopt a more heavyweight solution of just adding ENDBR instructions regardless, trusting them to have minimal performance impact and treating them as NOPs. According to the Intel doc quoted in the discussion here they can safely be modeled as a NOP and assumed to behave as such even on legacy processors: https://stackoverflow.com/questions/56905811/what-does-the-endbr64-instruction-actually-do My inclination is to go with your solution first and maybe think about the more far-reaching change in the future. Any other opinions? |
It was a pleasure, compared to other projects where I did IBT patching. The only bothersome part is the amount of files to patch. :D AFAIK, only OpenBSD enforces CET, with Intel CPUs from gen 11th and onwards. Also, we only do IBT, not full CET (we don't do shadow stacks).
After I thought more about it, from a maintainer point of view, I think the approach of the comment (defining a macro that outputs a function preamble) is better, in the sense that there is no need for another 629-files patch. But well, I'm not a maintainer. I'm still up for biting the bullet again, if you prefer that approach. |
Hello @jargh ! Are there any updates in here? We really we can merge it so it can eventually backpropagate to aws-lc-rs/aws-lc-sys, as more things in Rust land are depending on it. |
Sorry for dropping the ball on this. I don't think we'll have time to go for the more complex solution of actually formally modeling the |
Hey jargh! I rebased the PR onto
after https://github.com/awslabs/s2n-bignum/blob/main/codebuild/tests.yml#L12 should do the trick. Feel free to drop it if it isn't desired. |
Many thanks! I'm working on assimilating and checking it. I'll also experiment a bit to see what the performance hit seems to be, because if it's not much (and assuming there are no other issues) we really may want to prioritize making this the default and updating the proofs accordingly. |
Since all our code is assuming 64-bit mode, I suspect we're safe ignoring I'm actually somewhat warming to the idea of making this the default and updating the proofs, but let me do a bit more investigating and poll some other people about what they think. |
Description of changes: as the title reads, this sprinkles
endbr64
/endbr32
as needed in the assembler files to be able to run with CET enabled. I tested this on an i7 1165G7 on OpenBSD, as CET is enabled by default there. I do get SIGILLs without the patch, and the testsuite passes with it. The PR affects quite a lot of files as it basically adds a_CET_ENDBR
after each function definition. The following script was used for patching the files:The
sed
machinery is only needed to avoid adding multiple_CET_ENDBR
s in definitions likeBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.