jshmrtn/ex-openssl

SegFault on MacOS

Closed this issue · 0 comments

Bountysource

There is a SegFault on Mac OS X 10.13. It seems to only happen on macos and not on Linux.

$ USE_LLDB=1 mix test
(lldb) command source -s 0 '/tmp/rust-lldb-commands.c8UduS'
Executing commands in '/tmp/rust-lldb-commands.c8UduS'.
(lldb) command script import "/usr/local/Cellar/rust/1.22.1/lib/rustlib/etc/lldb_rust_formatters.py"
(lldb) type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
(lldb) type category enable Rust
(lldb) target create "/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec"
Current executable set to '/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec' (x86_64).
(lldb) settings set -- target.run-args  "--args" "/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec" "-pa" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/eex/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/elixir/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/ex_unit/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/iex/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/logger/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/mix/ebin" "-elixir" "ansi_enabled" "true" "-noshell" "-s" "elixir" "start_cli" "-extra" "/usr/local/bin/mix" "test"
(lldb) run
Process 82631 launched: '/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec' (x86_64)
Process 82631 stopped
* thread #2, stop reason = exec
    frame #0: 0x000000001035a19c dyld`_dyld_start
dyld`_dyld_start:
->  0x1035a19c <+0>: popq   %rdi
    0x1035a19d <+1>: pushq  $0x0
    0x1035a19f <+3>: movq   %rsp, %rbp
    0x1035a1a2 <+6>: andq   $-0x10, %rsp
Target 0: (beam.smp) stopped.
(lldb) continue
Process 82631 resuming
Compiling NIF crate :exopenssl (native/exopenssl)...
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Process 82631 stopped
* thread #22, name = '8_scheduler', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (beam.smp) stopped.
(lldb) bt
* thread #22, name = '8_scheduler', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000000000000
    frame #1: 0x0000000018e7b40d libcrypto.1.1.dylib`EVP_CipherInit_ex + 702
    frame #2: 0x0000000018ea0e69 libcrypto.1.1.dylib`PKCS7_dataInit + 717
    frame #3: 0x0000000018ea085d libcrypto.1.1.dylib`pk7_cb + 90
    frame #4: 0x0000000018dc644b libcrypto.1.1.dylib`BIO_new_NDEF + 209
    frame #5: 0x0000000018dc387e libcrypto.1.1.dylib`i2d_ASN1_bio_stream + 62
    frame #6: 0x0000000018dc3c3c libcrypto.1.1.dylib`B64_write_ASN1 + 84
    frame #7: 0x0000000018dc407a libcrypto.1.1.dylib`SMIME_write_ASN1 + 995
    frame #8: 0x0000000018ea3bdd libcrypto.1.1.dylib`SMIME_write_PKCS7 + 96
    frame #9: 0x0000000018a346d0 libexopenssl.so`openssl::crypto::pkcs7::pk7_smime::PKCS7::smime_write::h8cdfd386f1cfc883 + 784
    frame #10: 0x00000000189d992f libexopenssl.so`exopenssl::crypto::pkcs7::smime::write::h19eb48c76451c5b6 + 2431
    frame #11: 0x00000000189ed6db libexopenssl.so`rustler::codegen_runtime::handle_nif_call::_$u7b$$u7b$closure$u7d$$u7d$::h79244b291af935f2 + 171
    frame #12: 0x00000000189e993d libexopenssl.so`std::panicking::try::do_call::h10e475cd929785d0 + 93
    frame #13: 0x0000000018ac37fd libexopenssl.so`__rust_maybe_catch_panic + 29
    frame #14: 0x00000000189e983e libexopenssl.so`std::panicking::try::hab939d6c0c62c184 + 190
    frame #15: 0x00000000189e61b2 libexopenssl.so`std::panic::catch_unwind::ha9388196fd28dd86 + 98
    frame #16: 0x00000000189ed3b1 libexopenssl.so`rustler::codegen_runtime::handle_nif_call::h76c8de0c6446e920 + 337
    frame #17: 0x00000000189df986 libexopenssl.so`exopenssl::nif_init::FUN_ENTRIES::nif_func::h60cef4053a7de575 + 86
    frame #18: 0x0000000010008dbb beam.smp`process_main + 26706
    frame #19: 0x000000001008f14d beam.smp`sched_thread_func + 362
    frame #20: 0x00000000101f4179 beam.smp`thr_wrapper + 159
    frame #21: 0x00007fff6b45f6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #22: 0x00007fff6b45f56d libsystem_pthread.dylib`_pthread_start + 377
    frame #23: 0x00007fff6b45ec5d libsystem_pthread.dylib`thread_start + 13