-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add proper CET support #1290
Add proper CET support #1290
Conversation
Thanks! I think we don't need a specific header for that; it could fit into Do functions from The previous PR only added IBT prologues to entry points. Shouldn't that be enough? |
CI doesn't like it. We can have |
And OpenBSD has support for IBT, has
|
Well, OpenBSD does, but only when |
Actually,
So, could the reason it is failing on OpenBSD be that |
... or just that I was dumb and didn't use it in a |
Ack, I'll fix this.
Since it's internal-only, it's not strictly needed right now, but I added it in as a precaution in case there's ever an indirect call in future.
The previous PR added property notes, no IBT prologues, or maybe I misunderstand your comment? |
Use cet.h if available and use _CET_ENDBR to make all the functions IBT-safe. This is not directly testable yet, but the instruction is in the nop space for processors that don't support it, so it's a harmless addition. cet.h also includes the SHSTK and IBT GNU properties in ELF, so remove the manually added ones.
Actually The joy of compiler diversity :) |
OK, if this is too painful across compilers then maybe it makes sense to just drop it, especially if these functions are always going to be internal-only and will likely never be called through an indirect branch. The property notes I had added in the earlier PR are sufficient to get support working. |
Yes, these functions are always going to be internal, and the symbols are all private. CET is not a Linux-only thing. It's already enforced everywhere by default in OpenBSD. Is what you previously sent guaranteed to be compatible with all operating systems and linkers? Sorry, I'm not too familiar with this, and don't fully understand where these values come from. Is this also compatible both with |
Including I think we should just check for its existence, that is actually contains |
Agreed, I tested #1291 and it works well. Closing this one, thanks! |
Use cet.h if available and use _CET_ENDBR to make all the functions IBT-safe. This is not directly testable yet, but the instruction is in the nop space for processors that don't support it, so it's a harmless addition.
cet.h also includes the SHSTK and IBT GNU properties in ELF, so remove the manually added ones.
Sorry, I missed this in my previous patch because there's no Linux kernel support for IBT yet. This is a more complete fix to making libsodium properly CET-enabled.