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

Out-of-memory causes SIGILL #21592

Closed
mpdn opened this issue Jan 24, 2015 · 6 comments
Closed

Out-of-memory causes SIGILL #21592

mpdn opened this issue Jan 24, 2015 · 6 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

Comments

@mpdn
Copy link
Contributor

mpdn commented Jan 24, 2015

This snippet: (Playpen link)

#![allow(unstable)]

extern crate test;

fn main() {
    let a: Vec<u8> = Vec::with_capacity(::std::usize::MAX);
    ::test::black_box(a);
}

Causes the program to close with a SIGILL (Illegal instruction) error. I would have expected something like a SIGSEGV instead.

@sfackler
Copy link
Member

This is working as intended. Rust calls the LLVM trap intrinsic which is compiled to the ud2 instruction which in turn generates a SIGILL..

@mpdn
Copy link
Contributor Author

mpdn commented Jan 24, 2015

But oom calls abort. Shouldn't it use SIGABRT instead? To me, SIGILL makes it seem like the compiler is at fault, which it clearly isn't.

@kmcallister kmcallister added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-diagnostics Area: Messages for errors, warnings, and lints labels Jan 24, 2015
@kmcallister
Copy link
Contributor

This does confuse people. We could override LLVM's choice if we want to. A standard SIGABRT handler might be nice.

@alexcrichton
Copy link
Member

Closing as a dupe of #14674, but thanks for the issue!

@BenWiederhake
Copy link
Contributor

BenWiederhake commented Jan 7, 2017

How is this a duplicate? The other issue is about OOM not being printed on stackoverflow, which seems to be fixed.
OOM still causes SIGILL, which is very confusing indeed, and should be fixed somehow. So I'd say this is still an "open" issue.

Maybe oom_handler (which for my system resides in src/libstd/sys/unix/mod.rs) should also call to ::libc::abort() instead of ::intrinsics::abort, just like in the fix for #31273?

As Ixrec helpfully pointed out in chat, I probably should have linked to the pull request by number: #31457

@sfackler
Copy link
Member

sfackler commented Jan 7, 2017

The word "stack" does not appear in #14674, unless I'm missing somethign.

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-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
Projects
None yet
Development

No branches or pull requests

5 participants