Skip to content

Please add support for Intel CET #73820

Closed as not planned
Closed as not planned
@xnox

Description

@xnox

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.

$ cat empty.c 
void main(){}
$ cat empty.rs 
fn main(){}
$ gcc -fcf-protection -o gcc-c empty.c
$ clang -fcf-protection -o clang-c empty.c
$ rustc  -o rustc empty.rs
$ readelf -a gcc-c | grep feature:
      Properties: x86 feature: IBT, SHSTK
$ readelf -a clang-c | grep feature:
      Properties: x86 feature: IBT, SHSTK
$ readelf -a rustc | grep feature:
$ echo $?
1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-linkageArea: linking into static, shared libraries and binariesC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions