Skip to content

Commit

Permalink
unconditionally allow shadow call-stack for AArch64 whenever fixed-x1…
Browse files Browse the repository at this point in the history
…8 is applied
  • Loading branch information
dingxiangfei2009 committed Jul 29, 2024
1 parent a5ee5cb commit 558f649
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) {

// Sanitizers can only be used on platforms that we know have working sanitizer codegen.
let supported_sanitizers = sess.target.options.supported_sanitizers;
let unsupported_sanitizers = sess.opts.unstable_opts.sanitizer - supported_sanitizers;
let mut unsupported_sanitizers = sess.opts.unstable_opts.sanitizer - supported_sanitizers;
// Niche: if `fixed-x18`, or effectively switching on `reserved-x18` flag, is enabled
// we should allow Shadow Call Stack sanitizer.
if sess.opts.unstable_opts.fixed_x18 && sess.target.arch == "aarch64" {
unsupported_sanitizers -= SanitizerSet::SHADOWCALLSTACK;
}
match unsupported_sanitizers.into_iter().count() {
0 => {}
1 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pub fn target() -> Target {
&["--fix-cortex-a53-843419"],
),
features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
supported_sanitizers: SanitizerSet::KCFI
| SanitizerSet::KERNELADDRESS
| SanitizerSet::SHADOWCALLSTACK,
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(128),
Expand Down

0 comments on commit 558f649

Please sign in to comment.