Bug #655
proposed patch to diffie_hellman.c
Description
The attached patch performs thread safe initialization, as opposed to the current initialization which is potentially unsafe, and thread-safety tools (like tsan) tend to complain about.
History
#1 Updated by Martin Willi about 11 years ago
- Category set to libstrongswan
- Status changed from New to Assigned
- Assignee set to Martin Willi
#2 Updated by Martin Willi about 11 years ago
Noam,
The attached patch performs thread safe initialization, as opposed to the current initialization which is potentially unsafe
Thanks for your patch. I agree, that should be fixed.
Directly relying on <pthread.h>
and pthread_once()
is not ideal, though. Not all builds use pthreads, on Windows we use native threading primitives.
As we currently have no abstraction for pthread_once
functionality (#640), for the time being we probably just should use explicit initialization.
I've pushed the referenced commit, queued for a merge to master.
Regards
Martin
#3 Updated by Noam Lampert about 11 years ago
For reference, pthread_once is used elsewhere in strongswan, so the proposed patch was not introducing a new dependency.
libstrongswan/threading/rwlock.c
libstrongswan/utils/chunk.c
libstrongswan/utils/utils/strerror.c
libfast/fast_request.c
#4 Updated by Martin Willi about 11 years ago
This was true for releases before 5.2.0, but we explicitly removed these dependencies for the Windows support introduced with 5.2.0.
threading/rwlock.c
is the pthread implementation of rwlocks, so that doesn't hurt. libfast
is a very specific library not used in most builds, and has other Unix dependencies.
Regards
Martin
#5 Updated by Martin Willi about 11 years ago
- Status changed from Assigned to Closed
- Resolution set to Fixed
#6 Updated by Martin Willi about 11 years ago
- Tracker changed from Issue to Bug
- Target version set to 5.2.1