[Opendnssec-user] C_CloseAllSessions and threads

Casper Gielen c.gielen at uvt.nl
Fri Jan 18 12:03:36 UTC 2013


Op 18-01-13 12:19, Fredrik Thulin schreef:> Hi
>
> There are several issues in SoftHSM when using threads and
> C_CloseAllSessions.
>
> I'm not a C++ programmer, but I believe the issue is that
> C_CloseAllSessions 'delete's sessions although the sessions can be in
> use in another thread - causing segmentation faults in the other thread.
>
> The attached patch to the test suite easily demonstrates the problem on
> my system. Ubuntu 12.04, SoftHSM rev 6958.
>
> $ gdb --args ./checks -o
> ...
<snip>
> So session->rng is now an invalid reference since C_CloseAllSessions did
> 'delete' on the session from another thread.
>
> I've seen this problem in C_GenerateKeyPair (also due to session->rng)
> and in unknown place(s) crashing out in sqlite as well.

I've encountered this problem before. I have been told that this is more
or less a fundamentel problem with PKCS11. To fix it some kind of
front-end should be created that keeps track of the sessions and
intercepts calls to C_CloseAllSessions.
The p11-glue project may have a solution but I don't know the status of
that project.
-- 
Casper Gielen <cgielen at uvt.nl> | LIS UNIX
PGP fingerprint = 16BD 2C9F 8156 C242 F981  63B8 2214 083C F80E 4AF7

Universiteit van Tilburg | Postbus 90153, 5000 LE
Warandelaan 2 | Telefoon 013 466 4100 | G 236 | http://www.uvt.nl




-- 
Casper Gielen <cgielen at uvt.nl> | LIS UNIX
PGP fingerprint = 16BD 2C9F 8156 C242 F981  63B8 2214 083C F80E 4AF7

Universiteit van Tilburg | Postbus 90153, 5000 LE
Warandelaan 2 | Telefoon 013 466 4100 | G 236 | http://www.uvt.nl





More information about the Opendnssec-user mailing list