Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[illumos] stack exhaustion doesn't print "thread has overflowed its stack" messages #128568

Closed
sunshowers opened this issue Aug 2, 2024 · 2 comments · Fixed by #130132
Closed
Labels
C-bug Category: This is a bug. O-illumos the other shiny OS T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@sunshowers
Copy link
Contributor

I tried this code:

fn recurse(remaining: usize) {
    if remaining > 0 {
        recurse(remaining - 1);
    }
}

recurse(1048576);

Also reproducible with this example program: https://github.com/sunshowers/stack-exhaust-test, by running cargo run.

I expected to see this happen: Similar to Linux:

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

Instead, this happened:

zsh: segmentation fault (core dumped)  cargo run

Meta

rustc --version --verbose:

rustc 1.80.0 (051478957 2024-07-21)
binary: rustc
commit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9
commit-date: 2024-07-21
host: x86_64-unknown-illumos
release: 1.80.0
LLVM version: 18.1.7

Also reproduces with:

rustc 1.82.0-nightly (7120fdac7 2024-07-25)
binary: rustc
commit-hash: 7120fdac7a6e55a5e4b606256042890b36067052
commit-date: 2024-07-25
host: x86_64-unknown-illumos
release: 1.82.0-nightly
LLVM version: 18.1.7
Backtrace

(there's no backtrace, which I believe is expected in this situation)

% RUST_BACKTRACE=1 cargo +nightly run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/stack-exhaust-test`
running with use_stacker = No, new_thread = false, make_large_local = false
zsh: segmentation fault (core dumped)  RUST_BACKTRACE=1 cargo +nightly run

@sunshowers sunshowers added the C-bug Category: This is a bug. label Aug 2, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 2, 2024
@bjorn3
Copy link
Member

bjorn3 commented Aug 2, 2024

#[cfg(any(
target_os = "linux",
target_os = "freebsd",
target_os = "hurd",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris"
))]
mod imp {
probably needs to add illumos as supported OS.

@sunshowers
Copy link
Contributor Author

Thanks! Tried fixing it, but it's blocked on rust-lang/libc#3788 landing and making its way to rustc.

@jieyouxu jieyouxu added T-libs Relevant to the library team, which will review and decide on the PR/issue. O-illumos the other shiny OS and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 4, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Sep 10, 2024
…trieb

[illumos] enable SIGSEGV handler to detect stack overflows

Use the same code as Solaris. I couldn't find any tests regarding this, but I did test a stage0 build against my stack-exhaust-test binary [1]. Before:

```
running with use_stacker = No, new_thread = false, make_large_local = false
zsh: segmentation fault (core dumped)  cargo run
```

After:

```
running with use_stacker = No, new_thread = false, make_large_local = false

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: IOT instruction (core dumped)  cargo +stage0 run
```

Fixes rust-lang#128568.

[1] https://github.com/sunshowers/stack-exhaust-test/
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Sep 10, 2024
…trieb

[illumos] enable SIGSEGV handler to detect stack overflows

Use the same code as Solaris. I couldn't find any tests regarding this, but I did test a stage0 build against my stack-exhaust-test binary [1]. Before:

```
running with use_stacker = No, new_thread = false, make_large_local = false
zsh: segmentation fault (core dumped)  cargo run
```

After:

```
running with use_stacker = No, new_thread = false, make_large_local = false

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: IOT instruction (core dumped)  cargo +stage0 run
```

Fixes rust-lang#128568.

[1] https://github.com/sunshowers/stack-exhaust-test/
@bors bors closed this as completed in 54672ac Sep 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 10, 2024
Rollup merge of rust-lang#130132 - sunshowers:illumos-sigsegv, r=Noratrieb

[illumos] enable SIGSEGV handler to detect stack overflows

Use the same code as Solaris. I couldn't find any tests regarding this, but I did test a stage0 build against my stack-exhaust-test binary [1]. Before:

```
running with use_stacker = No, new_thread = false, make_large_local = false
zsh: segmentation fault (core dumped)  cargo run
```

After:

```
running with use_stacker = No, new_thread = false, make_large_local = false

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: IOT instruction (core dumped)  cargo +stage0 run
```

Fixes rust-lang#128568.

[1] https://github.com/sunshowers/stack-exhaust-test/
shrirambalaji pushed a commit to shrirambalaji/rust that referenced this issue Oct 6, 2024
Use the same code as Solaris. I couldn't find any tests regarding this, but I
did test a stage0 build against my stack-exhaust-test binary [1]. Before:

```
running with use_stacker = No, new_thread = false, make_large_local = false
zsh: segmentation fault (core dumped)  cargo run
```

After:

```
running with use_stacker = No, new_thread = false, make_large_local = false

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: IOT instruction (core dumped)  cargo +stage0 run
```

Fixes rust-lang#128568.

[1] https://github.com/sunshowers/stack-exhaust-test/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-illumos the other shiny OS T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants