I have encountered a similar problem when running test case of ima-evm-
utils with softhsm used as engine on Ubuntu 24.04 (Noble). In this case
I am also crashing in pkcs11_slot_unref when this line here is called:

        CRYPTOKI_call(slot->ctx, C_CloseAllSessions(slot->id));

https://github.com/OpenSC/libp11/blob/libp11-0.4.12/src/p11_slot.c#L433

ima-evm-utils: https://github.com/mimizohar/ima-evm-utils-test/

The evmctl utility has left main() when the crash occurs. So this function is 
called via some OpenSSL destructor code path. When OPENSSL_cleanup() is called 
before main() exits then this crash does NOT occur. 
When single stepping through the crash then it seems that C_CloseAllSessions() 
does not get called anymore but the crash occurs when it seems like it was 
trying to call this function.

   0x00007ffff7fb3530 <+96>:    call   0x7ffff7fae110 <OPENSSL_cleanse@plt>
   0x00007ffff7fb3535 <+101>:   mov    0x98(%rbx),%rdi
   0x00007ffff7fb353c <+108>:   mov    $0x1af,%edx
   0x00007ffff7fb3541 <+113>:   mov    %r13,%rsi
   0x00007ffff7fb3544 <+116>:   call   0x7ffff7fadea0 <CRYPTO_free@plt>
=> 0x00007ffff7fb3549 <+121>:   mov    0x8(%rbx),%rax
   0x00007ffff7fb354d <+125>:   mov    0x70(%rbx),%rdi
   0x00007ffff7fb3551 <+129>:   mov    (%rax),%rax
   0x00007ffff7fb3554 <+132>:   call   *0x78(%rax)             <----- crash 
occurs here
   0x00007ffff7fb3557 <+135>:   mov    0x78(%rbx),%rdi

Notes:
- When SoftHSM is used in a test case via an OpenSSL provider, this same crash 
does NOT occur.
- The same test passes on Fedora (latest) when using SoftHSM either via engine 
or provider interfaces.
- Another problem is that I cannot use OPENSSL_cleanup before main() exit since 
tests on AltLinux and Debian end up failing then for some unknown reason.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2059340

Title:
  crash in libsofthsm2 on armhf after time_t transition

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/softhsm2/+bug/2059340/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to