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

rustc: malloc.c:2388: sysmalloc: Assertion failed #28180

Closed
cuviper opened this issue Sep 3, 2015 · 3 comments
Closed

rustc: malloc.c:2388: sysmalloc: Assertion failed #28180

cuviper opened this issue Sep 3, 2015 · 3 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@cuviper
Copy link
Member

cuviper commented Sep 3, 2015

I was playing with examples for #28179 and hit this assertion in the playpen.

fn main() {
  println!("ok")
}

#[no_mangle]
#[allow(non_snake_case)]
pub fn _ZN2io5stdio6_print20h94cd0587c9a534faX3gE() {
    std::process::exit(1);
}

That #[no_mangle] function needs to clash with rust's io::stdio::_print. This particular name is from stable 1.2. http://is.gd/YpEFlo

rustc: malloc.c:2388: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted (core dumped)
playpen: application terminated with error code 134
@cuviper
Copy link
Member Author

cuviper commented Sep 3, 2015

Updating the mangled name for the current nightly gave me this: http://is.gd/4aWIX0

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::Function; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::Function*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Aborted (core dumped)
playpen: application terminated with error code 134

@steveklabnik
Copy link
Member

tricky!

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 3, 2015
@alexcrichton
Copy link
Member

I don't think this is necessarily a bug that we can deal with, and I'm not sure if we would really achieve anything from trying to catch this. It's basically impossible to predict our symbol names reliably and this is just dealing with various linker tricks on Linux. If you take over random symbols then it's basically very likely you'll hit memory corruption.

As a result I'm going to close this because any infrastructure we add to protect against this seems like it wouldn't be worth its weight in maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants