Description
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.