Bug 1828395 - softhsm hangs in deadlock if the configuration points to non-existent path
Summary: softhsm hangs in deadlock if the configuration points to non-existent path
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: softhsm
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Paul Wouters
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-27 16:25 UTC by Anderson Sasaki
Modified: 2020-12-09 14:05 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-09 14:05:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Anderson Sasaki 2020-04-27 16:25:36 UTC
Description of problem:
If the SoftHSM configuration points to a non-existent path, it hangs in deadlock at exit.

Version-Release number of selected component (if applicable):
softhsm-2.6.0-1.fc33.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create a SoftHSM configuration file with an non-existent path. For example, containing:

directories.tokendir = XXX
objectstore.backend = file

2. Make SoftHSM to use the configuration file

$ export SOFTHSM2_CONF=config

3. run an application using libsofthsm2.so with the bad configuration. For example, using p11tool from gnutls-utils:

$ p11tool --list-tokens --provider /lib64/pkcs11/libsofthsm2.so

Actual results:

- The application hangs after printing:

pkcs11_add_provider: PKCS #11 error.


Expected results:
The application prints the error and exits instead of hanging.

Additional info:
- The same can be reproduced through pkcs11-tool from opensc:

$ pkcs11-tool --list-slots --module /lib64/pkcs11/libsofthsm2.so
error: PKCS11 function C_Initialize failed: rv = CKR_GENERAL_ERROR (0x5)
Aborting.

- An available workaround is to create the missing path pointed by the configuration file.

Comment 1 Ben Cotton 2020-08-11 13:20:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 2 Paul Wouters 2020-12-09 02:02:16 UTC
Although I see no related changelog entries for 2.6.1 this does seem to have been resolved:

paul@thinkpad:~$ cat /tmp/test.conf 
directories.tokendir = XXX
objectstore.backend = file

paul@thinkpad:~$ export SOFTHSM2_CONF=/tmp/test.conf
paul@thinkpad:~$ p11tool --list-tokens --provider /lib64/pkcs11/libsofthsm2.so
pkcs11_add_provider: PKCS #11 error.

paul@thinkpad:~$ pkcs11-tool --list-slots --module /lib64/pkcs11/libsofthsm2.so
error: PKCS11 function C_Initialize failed: rv = CKR_GENERAL_ERROR (0x5)
Aborting.

It does not hang for me.

Comment 3 Anderson Sasaki 2020-12-09 08:56:53 UTC
I can't reproduce the issue with latest version (softhsm-2.6.1-3). It works as expected.


Note You need to log in before you can comment on or make changes to this bug.