-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.0a1
-
Fix Version/s: 2.0.0
-
Component/s: None
-
Labels:None
-
Sprint:SoftHSM 2.0.0a2
We will get a segmentation fault if a thread changes an attribute while another thread is using it.
From SOFTHSM-36:
Rickard Bellgrim added a comment - 2013-10-22 12:26
The problem is that we may have handed out an attribute via ObjectFile::getAttribute() and then the attributes gets erased by ObjectFile::discardAttributes() when there is an update (ObjectFile::refresh()) to the object.
Francis Dupont added a comment - 2013-10-25 16:25
The getAttribute()/discardAttribute() is not really a locking issue: it is just a standard dangling pointer issue…
If we want to keep the value of the time we get the pointer (IMHO the reasonable assumption), I suggest to make getAttribute() to return a unique_ptr (or an auto_ptr on old systems) to a copy of the attribute. Even if compilers should optimise chained calls, I suggest too if we follow this way to factorize accesses.
- relates to
-
SOFTHSM-36 Threading issues
-
- Closed
-