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

Dynamic library, OSX, Segmentation fault #38370

Closed
adjivas opened this issue Dec 14, 2016 · 3 comments
Closed

Dynamic library, OSX, Segmentation fault #38370

adjivas opened this issue Dec 14, 2016 · 3 comments
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS

Comments

@adjivas
Copy link

adjivas commented Dec 14, 2016

Durring a test on Linux and OSX, I have found a SegV for OSX system for this code of demonstration.

According to my observations, the accident happend when the dlclose(3)'s function is called for a dynamic crate named hello is used without the nostd mode, it's why in my report a simple println!'s will cause a Segv.

I tried this code:
hello/src/lib.rs

#[no_mangle]
pub unsafe extern "C" fn start(common: *mut Segment) {
println!("This println cause de SegV when the dylib is closed");
...

src/main.rs

...
assert_ne!(libc::dlclose(handle), -1);

I expected to see this happen: 5763 Segmentation fault: 11

The rust-lldb trace:

(lldb) run
Process 5350 launched: '/Users/adjivas/Repos/share/target/debug/share' (x86_64)
This println cause de SegV when the dylib is closed
cProcess 5350 stopped
* thread #1: tid = 0x244c60, 0x000000010122ab80, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10122ab80)
    frame #0: 0x000000010122ab80
error: memory read failed for 0x10122aa00
@steveklabnik steveklabnik added O-macos Operating system: macOS I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. labels Dec 14, 2016
@alexcrichton
Copy link
Member

IIRC this is the same as nagisa/rust_libloading#5 and a dupe of #28794

@alexcrichton
Copy link
Member

Er didn't mean to close, I'm not 100% sure! If it is the same though, feel free to close!

@alexcrichton alexcrichton reopened this Dec 14, 2016
@adjivas
Copy link
Author

adjivas commented Dec 15, 2016

It's exactly the same issue as #28794, it's why I close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS
Projects
None yet
Development

No branches or pull requests

3 participants