Skip to content

Commit

Permalink
[build][rust] Enable Shadow Call Stack for Rust on AArch64 and RISC-V
Browse files Browse the repository at this point in the history
After rust-lang/rust#124676 was rolled, we can
enable SCS for both AArch64 and RISC-V, since it won't conflict with
other sanitizers in the compiler driver anymore.

Fixed: 42069386
Bug: 360955800
Change-Id: Ib30747204882317bb6b243c8a8ce760f09520a83
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/791504
Size-Review: Przemek Pietrzkiewicz <ppi@google.com>
Fuchsia-Auto-Submit: Paul Kirth <paulkirth@google.com>
Reviewed-by: Roland McGrath <mcgrathr@google.com>
Commit-Queue: Paul Kirth <paulkirth@google.com>
  • Loading branch information
ilovepi authored and CQ Bot committed Aug 20, 2024
1 parent bb1d71c commit 4eefc27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build/config/arm64/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ config("arm64") {
# rustc --target=aarch64-unknown-fuchsia --print target-features
# `armv8a` and `simd` features are assumed by the target triple
# `aarch64-unknown-fuchsia`.
rustflags = [ "-Ctarget-feature=+crc,+aes,+sha2" ]
rustflags = [
"-Ctarget-feature=+crc,+aes,+sha2",
"-Zsanitizer=shadow-call-stack",
]
}

config("cortex-a53") {
Expand Down
3 changes: 3 additions & 0 deletions build/config/riscv64/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ config("riscv64") {
cflags = [ "-msmall-data-limit=0" ]
}
configs = [ ":abi" ]

# TODO(https://fxbug.dev/360955800): remove the SCS option once the rustc driver can set it by default for Fuchsia targets
rustflags = [ "-Zsanitizer=shadow-call-stack" ]
}

riscv64_abi_config("no-vector") {
Expand Down

0 comments on commit 4eefc27

Please sign in to comment.