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

【1.45.2】 More error information is provided when the bottom-layer commands of the operating system fail to be invoked. #82388

Closed
silence-coding opened this issue Feb 22, 2021 · 4 comments · Fixed by #83223
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@silence-coding
Copy link

There is too little confidence in this mistake, why not return to errno. The mmap interface provides the errno, such as the ENOMEM and SIGSEGV interfaces.

/rust/src/libstd/sys/unix/stack_overflow.rs:150
panic!("failed to allocate an alternative stack")

@silence-coding silence-coding added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 22, 2021
@silence-coding
Copy link
Author

image

@tesuji
Copy link
Contributor

tesuji commented Feb 22, 2021

Please try again your code latest nightly Rust version. Also could you paste the ICE backtrace?

@rustbot label E-needs-mcve I-ICE

@rustbot rustbot added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Feb 22, 2021
@12101111
Copy link
Contributor

@tesuji This is not a ICE
This issue propose printing errno on this panic:

unsafe fn get_stackp() -> *mut libc::c_void {
let stackp = mmap(
ptr::null_mut(),
SIGSTKSZ + page_size(),
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON,
-1,
0,
);
if stackp == MAP_FAILED {
panic!("failed to allocate an alternative stack");
}

@thomcc
Copy link
Member

thomcc commented Feb 22, 2021

Probably we want this then:

@rustbot label: -I-ICE, -T-compiler, +T-libs

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 22, 2021
@jonas-schievink jonas-schievink added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Feb 22, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 17, 2021
…joshtriplett

Display error details when a `mmap` call fails

Fixes rust-lang#82388
@bors bors closed this as completed in 0340045 Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants