-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Please add support for Intel CET #73820
Comments
@hjl-tools not sure if you want to track this too. |
CET support in compiler is mostly implemented during codegen in the x86 backend. If rust frontend can properly pass BTW, LLVM 11 is needed for working CET support. LLVM 10.x should be OK. LLVM 10.0 doesn't have a working CET |
I think that probably applies to |
I stumbled on this because Fedora/RHEL run https://sourceware.org/annobin/annobin.html/Test-cf-protection.html as part of builds and it flags Rust code as not using CET. My initial thought was that trying this out would just be a matter of e.g. |
I found that Clang supports this by adding LLVM module flags, "cf-protection-branch" and "cf-protection-return". At a first attempt at hard-coding these, it does seem to work, producing a binary with this note:
I'm still testing, but if this works I'll see about a |
I don't know if this is related, but on rust 1.56.1, 1.57, and 1.58 (only ones I've tried), I'm getting CET opcodes where I don't want them #93059 (the i586 target) |
Oops, I just pushed a draft PR with initial support for CET but also several questions to resolve--apologies to @cuviper! Last I checked this thread was last year and I thought no one was working on this. @cuviper, or anyone who is interested, I would appreciate your comments on #93439 if you have a chance. |
@abrown No worries, I had lost my initial momentum. Thanks for picking it up! |
@xnox and all: #93439 adds initial support for CET behind the |
Closing this in favour of the tracking issue linked above |
https://www.linuxplumbersconf.org/event/2/contributions/147/attachments/72/83/CET-LPC-2018.pdf
When compiling C binaries with
-fcf-protection
the binaries are generated with Indirect Branch Tracking (IBT) Shadow Stack (SHSTK) features, and are thus CET enabled.I cannot find a way for rustc compiler to generate binaries with the gnu properties declared on the ELF binary, but also have the right
endbranch
instructions emitted.Trying to set CFLAGS/LDFLAGS/RUSTFLAGS did not make rustc compiler generate CET enabled binaries, thus I am assuming that rustc does not have support for CET.
I looked through the available codegen options and also did not find a way to generate CET enabled binaries.
Please add support for rustc to generate CET enabled binaries, when toolchain has support for it. Or please document how to make rustc do so, because gcc / LLVM and linkers have support for it.
The text was updated successfully, but these errors were encountered: