Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ pub(crate) fn target() -> Target {
base.features = "+cmpxchg16b,+lahfsahf,+popcnt,+sse3,+sse4.1,+sse4.2,+ssse3".into();
base.max_atomic_width = Some(128);
base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::SAFESTACK;
base.default_sanitizers = SanitizerSet::SAFESTACK;
base.supports_xray = true;

Target {
Expand Down

@adwinwhite adwinwhite Aug 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So __stack_chk_fail is optimized away if we have safe stack on?

Rather than remove testing for stack protector support, would it be better to mark the function with #[sanitize(safestack = "off")]?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So __stack_chk_fail is optimized away if we have safe stack on?

Specifically it's never emitted since the safestack machinery would move all stack references to the unsafe stack so the current safe stack wouldn't need the normal stack protector instrumentation.

Rather than remove testing for stack protector support, would it be better to mark the function with #[sanitize(safestack = "off")]?

Yeah I think that also works

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently safestack wasn't a valid option for that macro, but #161888 should make it one

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a comment on the sanitize attribute that we only do this because we can't disable default sanitizers via compile-flags?

Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ extern crate minicore;
use minicore::*;

#[no_mangle]
#[sanitize(safestack = "off")]
pub fn foo() {
// CHECK: foo{{:|()}}

Expand Down
Loading