libp11
libp11 copied to clipboard
libp11 hangs/deadlocks in p11_slot.c:pkcs11_get_session()
I am using libp11 as an engine for osslsigncode (openssl under the surface i suspect). When performing a sign operation, libp11 hangs in p11_slot.c:pkcs11_get_session()
. Note that I am running this in a bit of a non standard environment, and that when running directly on my regular system I do not have this problem.
When running this with gdb, I can see that the hang occurs at the call to pthread_cond_wait()
in pkcs11_get_session()
, and when putting a break point at pkcs11_get_session()
the output of the slot
, just before the hanging call, looks as below.
print *slot
$3 = {
refcnt = 0,
ctx = 0x0,
lock = {
__data = {
__lock = 0,
__count = 0,
__owner = 0,
__nusers = 0,
__kind = 0,
__spins = 0,
__list = {
__prev = 0x0,
__next = 0x0
}
},
__size = '\000' <repeats 39 times>,
__align = 0
},
cond = {
__data = {
__lock = 0,
__futex = 0,
__total_seq = 0,
__wakeup_seq = 0,
__woken_seq = 0,
__mutex = 0x0,
__nwaiters = 0,
__broadcast_seq = 0
},
__size = '\000' <repeats 47 times>,
__align = 0
},
rw_mode = 32 ' ',
logged_in = -2 '\376',
id = 0,
session_pool = 0x0,
session_head = 0,
session_tail = 0,
session_poolsize = 0,
num_sessions = 0,
max_sessions = 0,
forkid = 0,
prev_pin = 0x41 <error: Cannot access memory at address 0x41>,
secure_login = 0 '\000',
prv = {
num = 0,
keys = 0x0
},
pub = {
num = 0,
keys = 0x0
},
ncerts = 0,
certs = 0x0
}
I'm not sure if the original problem is caused by libp11, but at least it seems like it is calling pthread_cond_wait()
at a point in time where it should not.