tomaka / shared_library

Apache License 2.0
19 stars 15 forks source link

DynamicLibrary Drop SegV #6

Open adjivas opened 7 years ago

adjivas commented 7 years ago

Hello @tomaka ,

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

The accident happend when the DynamicLibrary's destructor is called. It's why mute this destructor solves the SegV but of course isn't the right solution and it's why I have opened this issue.

I think the Segmentation fault is caused by dlclose(3)'s call.

The rust-lldb trace:

(lldb) run
Process 92559 launched: './target/debug/share' (x86_64)
...
hello
Process 92559 stopped
* thread #1: tid = 0x38d5d4, 0x0000000100529500, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100529500)
    frame #0: 0x0000000100529500
error: memory read failed for 0x100529400

The travis-ci trace:

$ cargo run
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/share`
hello
/Users/travis/build.sh: line 57:  5584 Segmentation fault: 11  cargo run

The command "cargo run" exited with 139.

Done. Your build exited with 1.
/Users/travis/build.sh: line 148: shell_session_update: command not found
tomaka commented 7 years ago

Note that the code that opens/closes the library was copy-pasted from Rust's repository. I didn't write it and am not familiar with it.

adjivas commented 7 years ago

Yes, of course. I just report it like your repository is the more advanced.

adjivas commented 7 years ago

I also notify this append because the dynamic library writted in Rust isn't in nostd mode.