Skip to content

Commit 558f649

Browse files
unconditionally allow shadow call-stack for AArch64 whenever fixed-x18 is applied
1 parent a5ee5cb commit 558f649

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

compiler/rustc_session/src/session.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
11871187

11881188
// Sanitizers can only be used on platforms that we know have working sanitizer codegen.
11891189
let supported_sanitizers = sess.target.options.supported_sanitizers;
1190-
let unsupported_sanitizers = sess.opts.unstable_opts.sanitizer - supported_sanitizers;
1190+
let mut unsupported_sanitizers = sess.opts.unstable_opts.sanitizer - supported_sanitizers;
1191+
// Niche: if `fixed-x18`, or effectively switching on `reserved-x18` flag, is enabled
1192+
// we should allow Shadow Call Stack sanitizer.
1193+
if sess.opts.unstable_opts.fixed_x18 && sess.target.arch == "aarch64" {
1194+
unsupported_sanitizers -= SanitizerSet::SHADOWCALLSTACK;
1195+
}
11911196
match unsupported_sanitizers.into_iter().count() {
11921197
0 => {}
11931198
1 => {

compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ pub fn target() -> Target {
2121
&["--fix-cortex-a53-843419"],
2222
),
2323
features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
24-
supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
24+
supported_sanitizers: SanitizerSet::KCFI
25+
| SanitizerSet::KERNELADDRESS
26+
| SanitizerSet::SHADOWCALLSTACK,
2527
relocation_model: RelocModel::Static,
2628
disable_redzone: true,
2729
max_atomic_width: Some(128),

0 commit comments

Comments
 (0)