You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use the shadow call stack sanitizer, you must pass special flags:
* On arm64, you must pass -ffixed-x18 to your C compiler.
* On riscv, you must pass --no-relax-gp to your linker.
These requirements also apply to Rust code. When using Rust on arm64,
you must pass the -Zfixed-x18 flag to rustc, which has the same effect
as the -ffixed-x18 flag does for C code. The -Zfixed-x18 flag requires
rustc version 1.80.0 or greater.
There is no need to pass any flags to rustc on riscv as only the linker
requires additional flags on this platform.
On older versions of Rust, it is still possible to use shadow call stack
by passing -Ctarget-feature=+reserve-x18 instead of -Zfixed-x18.
However, this flag emits a warning during the build, so this patch does
not add support for using it.
Currently, the compiler thinks that the aarch64-unknown-none target
doesn't support -Zsanitizer=shadow-call-stack, so the build will fail if
you enable shadow call stack in non-dynamic mode. See [1] for the
feature request for this. To avoid this compilation failure, Kconfig is
set up to reject such configurations.
The `depends on` clause is placed on `config RUST` to avoid a situation
where enabling Rust silently turns off the sanitizer. Instead, turning
on the sanitizer results in Rust being disabled. We generally do not
want changes to CONFIG_RUST to result in any mitigations being changed
or turned off.
To avoid a cyclic dependency between RUST and RUSTC_VERSION, the
RUSTC_VERSION symbol is changed to depend on HAVE_RUST instead of RUST.
Link: rust-lang/rust#121972 [1]
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
0 commit comments