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

Expose the raw library and reason codes on Error #1848

Merged
merged 1 commit into from
Mar 19, 2023

Conversation

alex
Copy link
Collaborator

@alex alex commented Mar 19, 2023

No description provided.

@alex
Copy link
Collaborator Author

alex commented Mar 19, 2023

I don't know what's going with these 3.1.0 builds hanging. I'm using 3.1.0 to develop locally and it's fine :-/

@sfackler
Copy link
Owner

Looks like there's a deadlock somewhere in the 3.1.0 NID code. Yay.

@sfackler sfackler merged commit e62129f into sfackler:master Mar 19, 2023
@alex alex deleted the expose-lib-reason branch March 19, 2023 13:27
@sfackler
Copy link
Owner

Interestingly, there is no other live thread holding the lock, so it seems like it's a missing unlock call?

(gdb) info threads
  Id   Target Id                                           Frame
* 1    Thread 0x7ffff7cd8c00 (LWP 13407) "openssl-14a748f" 0x00007ffff7dde92d in syscall () from /lib64/libc.so.6
  103  Thread 0x7ffff5ec86c0 (LWP 13521) "nid::test::test" 0x00007ffff7d61c96 in __futex_abstimed_wait_common () from /lib64/libc.so.6
(gdb) thread 103
[Switching to thread 103 (Thread 0x7ffff5ec86c0 (LWP 13521))]
#0  0x00007ffff7d61c96 in __futex_abstimed_wait_common () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff7d61c96 in __futex_abstimed_wait_common () from /lib64/libc.so.6
#1  0x00007ffff7d6b4af in pthread_rwlock_wrlock@GLIBC_2.2.5 () from /lib64/libc.so.6
#2  0x000055555584d279 in CRYPTO_THREAD_write_lock (lock=<optimized out>) at crypto/threads_pthread.c:112
#3  0x000055555585ad54 in ossl_obj_write_lock (lock=1) at crypto/objects/obj_dat.c:96
#4  ossl_obj_write_lock (lock=1) at crypto/objects/obj_dat.c:90
#5  OBJ_create (oid=<optimized out>, sn=0x7fffc8001860 "foo", ln=0x7fffc8001d30 "foobar") at crypto/objects/obj_dat.c:754
#6  0x000055555560db09 in openssl::nid::Nid::create (oid="1.2.3.4", sn="foo", ln="foobar") at openssl/src/nid.rs:72
#7  0x0000555555681760 in openssl::nid::test::test_create () at openssl/src/nid.rs:1164
#8  0x00005555556a7cb7 in openssl::nid::test::test_create::{closure#0} () at openssl/src/nid.rs:1163
#9  0x00005555556eecc5 in core::ops::function::FnOnce::call_once<openssl::nid::test::test_create::{closure_env#0}, ()> ()
    at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ops/function.rs:250
#10 0x000055555575090f in core::ops::function::FnOnce::call_once<fn() -> core::result::Result<(), alloc::string::String>, ()> ()
    at library/core/src/ops/function.rs:250
#11 test::__rust_begin_short_backtrace<core::result::Result<(), alloc::string::String>, fn() -> core::result::Result<(), alloc::string::String>> ()
    at library/test/src/lib.rs:656
#12 0x00005555557225ac in test::run_test::{closure#1} () at library/test/src/lib.rs:647
#13 core::ops::function::FnOnce::call_once<test::run_test::{closure_env#1}, ()> () at library/core/src/ops/function.rs:250
#14 0x000055555574f96a in alloc::boxed::{impl#45}::call_once<(), (dyn core::ops::function::FnOnce<(), Output=core::result::Result<(), alloc::string::String>> + core::marker::Send), alloc::alloc::Global> () at library/alloc/src/boxed.rs:1988
#15 core::panic::unwind_safe::{impl#23}::call_once<core::result::Result<(), alloc::string::String>, alloc::boxed::Box<(dyn core::ops::function::FnOnce<(), Output=core::result::Result<(), alloc::string::String>> + core::marker::Send), alloc::alloc::Global>> () at library/core/src/panic/unwind_safe.rs:271
#16 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<alloc::boxed::Box<(dyn core::ops::function::FnOnce<(), Output=core::result::Result<(), alloc::string::String>> + core::marker::Send), alloc::alloc::Global>>, core::result::Result<(), alloc::string::String>> ()
    at library/std/src/panicking.rs:483
#17 std::panicking::try<core::result::Result<(), alloc::string::String>, core::panic::unwind_safe::AssertUnwindSafe<alloc::boxed::Box<(dyn core::ops::function::FnOnce<(), Output=core::result::Result<(), alloc::string::String>> + core::marker::Send), alloc::alloc::Global>>> ()
    at library/std/src/panicking.rs:447
#18 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<alloc::boxed::Box<(dyn core::ops::function::FnOnce<(), Output=core::result::Result<(), alloc::string::String>> + core::marker::Send), alloc::alloc::Global>>, core::result::Result<(), alloc::string::String>> ()
    at library/std/src/panic.rs:140
#19 test::run_test_in_process () at library/test/src/lib.rs:679
#20 test::run_test::run_test_inner::{closure#0} () at library/test/src/lib.rs:573
#21 0x000055555571cac1 in test::run_test::run_test_inner::{closure#1} () at library/test/src/lib.rs:600
#22 std::sys_common::backtrace::__rust_begin_short_backtrace<test::run_test::run_test_inner::{closure_env#1}, ()> ()
    at library/std/src/sys_common/backtrace.rs:121
#23 0x000055555572223b in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<test::run_test::run_test_inner::{closure_env#1}, ()> ()
    at library/std/src/thread/mod.rs:558
#24 core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::run_test_inner::{closure_env#1}, ()>> () at library/core/src/panic/unwind_safe.rs:271
#25 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::run_test_inner::{closure_env#1}, ()>>, ()> () at library/std/src/panicking.rs:483
#26 std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::run_test_inner::{closure_env#1}, ()>>> () at library/std/src/panicking.rs:447
#27 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::run_test_inner::{closure_env#1}, ()>>, ()> () at library/std/src/panic.rs:140
#28 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<test::run_test::run_test_inner::{closure_env#1}, ()> () at library/std/src/thread/mod.rs:557
#29 core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<test::run_test::run_test_inner::{closure_env#1}, ()>, ()> () at library/core/src/ops/function.rs:250
#30 0x0000555555adf0c3 in alloc::boxed::{impl#45}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> ()
    at library/alloc/src/boxed.rs:1988
#31 alloc::boxed::{impl#45}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global>
    () at library/alloc/src/boxed.rs:1988
#32 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#33 0x00007ffff7d6512d in start_thread () from /lib64/libc.so.6
#34 0x00007ffff7de6bc0 in clone3 () from /lib64/libc.so.6

@alex
Copy link
Collaborator Author

alex commented Mar 19, 2023

Found the issue: https://github.com/openssl/openssl/blob/openssl-3.1/crypto/objects/obj_dat.c#L742-L752

These goto err release the lock without ever having acquired it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants