Skip to content

Stack overflow segfaults instead of aborting on aarch64 for simple program #89949

Closed
@hkratz

Description

@hkratz

Running the following code with both stable (1.55.0) and nightly (2021-10-15) compiled for aarch64-apple-darwin on aarch64-apple-darwin segfaults instead of aborting:

fn main() {
    let t = [0_u8; 128 * 1024 * 1024];
    println!("{}", t[1000]);
}

Output:

~/dev/spikes/stacksizetest
$ cargo +nightly-aarch64-apple-darwin run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/stacksizetest`
Segmentation fault: 11

Debug/release does not matter.

On x86_64-apple-darwin the program aborts as expected:

 cargo +stable-x86_64-apple-darwin run
   Compiling stacksizetest v0.1.0 (/Users/hans/dev/spikes/stacksizetest)
    Finished dev [unoptimized + debuginfo] target(s) in 1.02s
     Running `target/debug/stacksizetest`

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Abort trap: 6

Same happens for aarch64-unknown-linux-gnu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-bugCategory: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions