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

libp11 hangs/deadlocks in p11_slot.c:pkcs11_get_session() #525

Open
ThinLinc-Zeijlon opened this issue Feb 22, 2024 · 0 comments
Open

libp11 hangs/deadlocks in p11_slot.c:pkcs11_get_session() #525

ThinLinc-Zeijlon opened this issue Feb 22, 2024 · 0 comments

Comments

@ThinLinc-Zeijlon
Copy link

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.

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

No branches or pull requests

1 participant