Skip to content
Merged
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
3 changes: 1 addition & 2 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,7 @@
# Indicates whether stack protectors should be used
# via the unstable option `-Zstack-protector`.
#
# Valid options are : `none`(default),`basic`,`strong`, or `all`.
# `strong` and `basic` options may be buggy and are not recommended, see rust-lang/rust#114903.
# Valid options are : `none`(default), `strong`, or `all`.
#rust.stack-protector = "none"

# Prints each test name as it is executed, to help debug issues in the test harness itself.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_gcc/src/gcc_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ pub fn new_context<'gcc>(sess: &Session) -> Context<'gcc> {
match sess.stack_protector() {
StackProtector::All => context.add_command_line_option("-fstack-protector-all"),
StackProtector::Strong => context.add_command_line_option("-fstack-protector-strong"),
StackProtector::Basic => context.add_command_line_option("-fstack-protector"),
StackProtector::None => (),
}

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ fn stackprotector_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll A
StackProtector::None => return None,
StackProtector::All => AttributeKind::StackProtectReq,
StackProtector::Strong => AttributeKind::StackProtectStrong,
StackProtector::Basic => AttributeKind::StackProtect,
};

Some(sspattr.create_attr(cx.llcx))
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,7 @@ mod desc {
"either no value or one of `legacy` (the default), `off`, or `next`";
pub(crate) const parse_annotate_moves: &str =
"either a boolean (`yes`, `no`, `on`, `off`, etc.), or a size limit in bytes";
pub(crate) const parse_stack_protector: &str =
"one of (`none` (default), `basic`, `strong`, or `all`)";
pub(crate) const parse_stack_protector: &str = "one of (`none` (default), `strong`, or `all`)";
pub(crate) const parse_branch_protection: &str = "a `,` separated combination of `bti`, `gcs`, `pac-ret`, (optionally with `pc`, `b-key`, `leaf` if `pac-ret` is set)";
pub(crate) const parse_proc_macro_execution_strategy: &str =
"one of supported execution strategies (`same-thread`, or `cross-thread`)";
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_session/src/options/mitigation_coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ impl DeniedPartialMitigationLevel {
pub fn level_str(&self) -> &'static str {
match self {
DeniedPartialMitigationLevel::StackProtector(StackProtector::All) => "=all",
DeniedPartialMitigationLevel::StackProtector(StackProtector::Basic) => "=basic",
DeniedPartialMitigationLevel::StackProtector(StackProtector::Strong) => "=strong",
// currently `=disabled` should not appear
DeniedPartialMitigationLevel::Enabled(false) => "=disabled",
Expand All @@ -36,9 +35,6 @@ impl std::fmt::Display for DeniedPartialMitigationLevel {
DeniedPartialMitigationLevel::StackProtector(StackProtector::All) => {
write!(f, "all")
}
DeniedPartialMitigationLevel::StackProtector(StackProtector::Basic) => {
write!(f, "basic")
}
DeniedPartialMitigationLevel::StackProtector(StackProtector::Strong) => {
write!(f, "strong")
}
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,12 +1204,6 @@ crate::target_spec_enum! {
/// Disable stack canary generation.
None = "none",

/// On LLVM, mark all generated LLVM functions with the `ssp` attribute (see
/// llvm/docs/LangRef.rst). This triggers stack canary generation in
/// functions which contain an array of a byte-sized type with more than
/// eight elements.
Basic = "basic",

/// On LLVM, mark all generated LLVM functions with the `sspstrong`
/// attribute (see llvm/docs/LangRef.rst). This triggers stack canary
/// generation in functions which either contain an array, or which take
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//@ revisions: all strong basic none missing
//@ revisions: all strong none missing
//@ assembly-output: emit-asm
//@ ignore-apple slightly different policy on stack protection of arrays
//@ ignore-msvc stack check code uses different function names
//@ ignore-nvptx64 stack protector is not supported
//@ ignore-wasm32-unknown-unknown
//@ [all] compile-flags: -Z stack-protector=all
//@ [strong] compile-flags: -Z stack-protector=strong
//@ [basic] compile-flags: -Z stack-protector=basic
//@ [none] compile-flags: -Z stack-protector=none
//@ compile-flags: -C opt-level=2 -Z merge-functions=disabled -Z allow-partial-mitigations=stack-protector

Expand All @@ -19,7 +18,6 @@
pub fn emptyfn() {
// all: __stack_chk_fail
// strong-NOT: __stack_chk_fail
// basic-NOT: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -37,7 +35,6 @@ pub fn array_char(f: fn(*const char)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -53,7 +50,6 @@ pub fn array_u8_1(f: fn(*const u8)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic-NOT: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -70,7 +66,6 @@ pub fn array_u8_small(f: fn(*const u8)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic-NOT: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -86,7 +81,6 @@ pub fn array_u8_large(f: fn(*const u8)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -105,7 +99,6 @@ pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -132,7 +125,6 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic-NOT: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -148,7 +140,6 @@ pub fn local_string_addr_taken(f: fn(&String)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand Down Expand Up @@ -177,7 +168,6 @@ pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32

// all: __stack_chk_fail
// strong-NOT: __stack_chk_fail
// basic-NOT: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand Down Expand Up @@ -214,7 +204,6 @@ pub fn local_large_var_moved(f: fn(Gigastruct)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand Down Expand Up @@ -251,7 +240,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -275,7 +263,6 @@ pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -287,7 +274,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand All @@ -299,7 +285,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {

// all: __stack_chk_fail
// strong: __stack_chk_fail
// basic: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
//@ revisions: all strong basic none missing
//@ revisions: all strong none missing
//@ assembly-output: emit-asm
//@ only-windows
//@ only-msvc
//@ ignore-64bit 64-bit table based SEH has slightly different behaviors than classic SEH
//@ [all] compile-flags: -Z stack-protector=all
//@ [strong] compile-flags: -Z stack-protector=strong
//@ [basic] compile-flags: -Z stack-protector=basic
//@ [none] compile-flags: -Z stack-protector=none
//@ compile-flags: -Z allow-partial-mitigations=stack-protector -C opt-level=2 -Z merge-functions=disabled -Cpanic=abort -Cdebuginfo=1

Expand All @@ -18,7 +17,6 @@
pub fn emptyfn() {
// all: __security_check_cookie
// strong-NOT: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie
}
Expand All @@ -36,7 +34,6 @@ pub fn array_char(f: fn(*const char)) {

// all: __security_check_cookie
// strong: __security_check_cookie
// basic: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -54,7 +51,6 @@ pub fn array_u8_1(f: fn(*const u8)) {

// all: __security_check_cookie
// strong: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -70,10 +66,10 @@ pub fn array_u8_small(f: fn(*const u8)) {
f(&b as *const _);

// Small arrays do not lead to stack protection by the 'basic' heuristic.
// (basic is not currently supported, leaving the test anyway).

// all: __security_check_cookie
// strong: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -88,10 +84,10 @@ pub fn array_u8_large(f: fn(*const u8)) {

// Since `a` is a byte array with size greater than 8, the basic heuristic
// will also protect this function.
// (basic is not currently supported, leaving the test anyway).

// all: __security_check_cookie
// strong: __security_check_cookie
// basic: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -109,10 +105,10 @@ pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) {

// Since `a` is a byte array in the LLVM output, the basic heuristic will
// also protect this function.
// (basic is not currently supported, leaving the test anyway).

// all: __security_check_cookie
// strong: __security_check_cookie
// basic: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -138,10 +134,10 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) {
// }
// EOF
// ```
// (basic is not currently supported, leaving the test anyway).

// all: __security_check_cookie
// strong: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -159,7 +155,6 @@ pub fn local_string_addr_taken(f: fn(&String)) {

// all: __security_check_cookie
// strong: __security_check_cookie
// basic: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand Down Expand Up @@ -190,7 +185,6 @@ pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32

// all: __security_check_cookie
// strong-NOT: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand Down Expand Up @@ -229,7 +223,6 @@ pub fn local_large_var_moved(f: fn(Gigastruct)) {

// all: __security_check_cookie
// strong: __security_check_cookie
// basic: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand Down Expand Up @@ -260,7 +253,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {

// all: __security_check_cookie
// strong: __security_check_cookie
// basic: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand Down Expand Up @@ -302,7 +294,6 @@ pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) {

// all: __security_check_cookie
// strong-NOT: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -316,7 +307,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {

// all: __security_check_cookie
// strong-NOT: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -330,7 +320,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {

// all: __security_check_cookie
// strong-NOT: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand All @@ -352,12 +341,10 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
// function and into `f()`, this is implemented with pass-by-reference
// using a suitably constructed fat-pointer (as if the functions
// accepted &[u8]). This function therefore doesn't need dynamic array
// alloca, and is therefore not protected by the `strong` or `basic`
// heuristics.
// alloca, and is therefore not protected by the `strong` heuristic.

// all-NOT: __security_check_cookie
// strong-NOT: __security_check_cookie
// basic-NOT: __security_check_cookie
// none-NOT: __security_check_cookie
// missing-NOT: __security_check_cookie

Expand Down
Loading
Loading