Tobias Brunner
cf6f56f619
Fixed some typos, courtesy of codespell
2022-12-22 19:03:37 +01:00
Tobias Brunner
42165f81bc
thread: Exclude thread_main() from AddressSanitizer
...
With GCC 11.3 AddressSanitizer causes the following crash when a thread
is cancelled (e.g. in the test_condvar_cancel test):
==84365==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/asan/asan_thread.cpp:367 "((ptr[0] == kCurrentStackFrameMagic)) != (0)" (0x0, 0x0)
#0 0x7ff0801b2988 in AsanCheckFailed ../../../../src/libsanitizer/asan/asan_rtl.cpp:74
#1 0x7ff0801d330e in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:78
#2 0x7ff0801b810c in __asan::AsanThread::GetStackFrameAccessByAddr(unsigned long, __asan::AsanThread::StackFrameAccess*) ../../../../src/libsanitizer/asan/asan_thread.cpp:367
#3 0x7ff080122e9b in __asan::GetStackAddressInformation(unsigned long, unsigned long, __asan::StackAddressDescription*) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:203
#4 0x7ff0801242d8 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:455
#5 0x7ff0801242d8 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:439
#6 0x7ff080126a84 in __asan::ErrorGeneric::ErrorGeneric(unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long) ../../../../src/libsanitizer/asan/asan_errors.cpp:389
#7 0x7ff0801b1fa5 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ../../../../src/libsanitizer/asan/asan_report.cpp:476
#8 0x7ff080148fe8 in __interceptor_sigaltstack ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:9986
#9 0x7ff0801af473 in __asan::PlatformUnpoisonStacks() ../../../../src/libsanitizer/asan/asan_posix.cpp:44
#10 0x7ff0801b500c in __asan_handle_no_return ../../../../src/libsanitizer/asan/asan_rtl.cpp:612
#11 0x7ff07fe04d50 in thread_main /media/sf_scratch/src/libstrongswan/threading/thread.c:321
#12 0x7ff07d7d4b42 in start_thread nptl/pthread_create.c:442
#13 0x7ff07d8669ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff)
2022-12-02 14:56:31 +01:00
Tobias Brunner
19ef2aec15
Update copyright headers after acquisition by secunet
2022-06-28 10:22:56 +02:00
Tobias Brunner
f6aafb3005
Fixed some typos, courtesy of codespell
...
Main change is the conversion from the British cancelling/-ed to the
American canceling/-ed.
2021-06-25 11:32:29 +02:00
Josh Soref
b3ab7a48cc
Spelling fixes
...
* accumulating
* acquire
* alignment
* appropriate
* argument
* assign
* attribute
* authenticate
* authentication
* authenticator
* authority
* auxiliary
* brackets
* callback
* camellia
* can't
* cancelability
* certificate
* choinyambuu
* chunk
* collector
* collision
* communicating
* compares
* compatibility
* compressed
* confidentiality
* configuration
* connection
* consistency
* constraint
* construction
* constructor
* database
* decapsulated
* declaration
* decrypt
* derivative
* destination
* destroyed
* details
* devised
* dynamic
* ecapsulation
* encoded
* encoding
* encrypted
* enforcing
* enumerator
* establishment
* excluded
* exclusively
* exited
* expecting
* expire
* extension
* filter
* firewall
* foundation
* fulfillment
* gateways
* hashing
* hashtable
* heartbeats
* identifier
* identifiers
* identities
* identity
* implementers
* indicating
* initialize
* initiate
* initiation
* initiator
* inner
* instantiate
* legitimate
* libraries
* libstrongswan
* logger
* malloc
* manager
* manually
* measurement
* mechanism
* message
* network
* nonexistent
* object
* occurrence
* optional
* outgoing
* packages
* packets
* padding
* particular
* passphrase
* payload
* periodically
* policies
* possible
* previously
* priority
* proposal
* protocol
* provide
* provider
* pseudo
* pseudonym
* public
* qualifier
* quantum
* quintuplets
* reached
* reading
* recommendation to
* recommendation
* recursive
* reestablish
* referencing
* registered
* rekeying
* reliable
* replacing
* representing
* represents
* request
* request
* resolver
* result
* resulting
* resynchronization
* retriable
* revocation
* right
* rollback
* rule
* rules
* runtime
* scenario
* scheduled
* security
* segment
* service
* setting
* signature
* specific
* specified
* speed
* started
* steffen
* strongswan
* subjectaltname
* supported
* threadsafe
* traffic
* tremendously
* treshold
* unique
* uniqueness
* unknown
* until
* upper
* using
* validator
* verification
* version
* version
* warrior
Closes strongswan/strongswan#164 .
2020-02-11 18:23:07 +01:00
Tobias Brunner
1b67166921
Unify format of HSR copyright statements
2018-05-23 16:32:53 +02:00
Tobias Brunner
4af1fd59dd
thread: Properly clean up meta data of thread if pthread_create() fails
2018-04-19 18:22:15 +02:00
Tobias Brunner
960632ffb0
thread: Don't hold mutex when calling cleanup handlers while terminating
...
This could interfere with cleanup handlers that try to acquire
mutexes while other threads holding these try to e.g. cancel the threads.
As cleanup handlers are only queued by the threads themselves we don't need
any synchronization to access the list.
Fixes #1401 .
2016-04-13 13:55:20 +02:00
Thomas Egerer
8ea4cb3e5d
thread: Allow thread ID to be value returned by gettid()
...
Signed-off-by: Thomas Egerer <[email protected] >
2016-03-04 09:12:11 +01:00
Martin Willi
d36b30803e
thread: Add a function to pop and call all registered cleanup handlers
2015-04-15 14:38:43 +02:00
Martin Willi
ef33f8e85d
thread: Don't acquire lock for thread_cleanup_push/pop
...
This is called only by the thread for its own thread_t, and does not need
synchronization.
2015-04-15 14:38:42 +02:00
Martin Willi
7394ad92ae
thread: Remove unneeded thread startup synchronization
...
sem_init() is deprecated on OS X, and it actually fails with ENOSYS. Using our
wrapped semaphore object is not an option, as it relies on the thread cleanup
that we can't rely on at this stage.
It is unclear why startup synchronization is required, as we can allocate the
thread ID just before creating the pthread. There is a chance that we allocate
a thread ID for a thread that fails to create, but the risk and consequences
are negligible.
2015-04-13 14:50:45 +02:00
Martin Willi
c6b588bf06
thread: Add a Windows pthread variant to print thread identifiers
2014-06-03 12:24:34 +02:00
Tobias Brunner
0d30d73eb9
thread: Properly clean up meta data of main thread
2014-03-07 18:28:38 +01:00
Martin Willi
01c0267778
thread: implicitly create thread_t if an external thread calls thread_current()
2013-07-18 12:17:53 +02:00
Tobias Brunner
bc07fef09c
Use SIGUSR2 for SIG_CANCEL on Android
...
SIGRTMIN is defined as 32 while sigset_t is defined as
unsigned long (i.e. holds 32 signals). Hence, the signal
could never be blocked. Sending the signal still canceled
threads, but sometimes in situations where they shouldn't
have been canceled (e.g. while holding a lock).
Fixes #298 .
2013-02-26 11:40:34 +01:00
Tobias Brunner
f05b427265
Moved debug.[ch] to utils folder
2012-10-24 16:00:51 +02:00
Tobias Brunner
12642a6831
Moved data structures to new collections subfolder
2012-10-24 16:00:49 +02:00
Tobias Brunner
efbb5e8c57
Ensure thread IDs always start with 1 even if the library is reused
...
Within the Android App the library stays loaded in memory and is just
initialized/deinitialized with each connection, the static thread
counter would continuously increase without this patch.
2012-08-13 11:28:08 +02:00
Tobias Brunner
17e3a92661
Fix gettid() on Android, which is defined in unistd.h there.
2012-01-12 11:08:22 +01:00
Tobias Brunner
66f16d9629
Use native gettid() if available (which is the case on Android).
2012-01-10 18:31:33 +01:00
Tobias Brunner
c17f6f96e2
Log native thread ID when a thread is created.
...
If possible gettid() is used, otherwise pthread_self() is logged (which is
not completely portable, but seems to work on most supported platforms).
2011-12-16 16:44:38 +01:00
Martin Willi
005b02cbe3
Create a dummy pthread key for value "0", as some buggy PKCS#11 libraries mangle it
2011-12-07 13:42:07 +01:00
Tobias Brunner
c8541efe70
Migrated thread_t to INIT/METHOD macros.
2011-10-03 15:54:36 +02:00
Andreas Steffen
51f259a82d
id of non-registered threads defaults to 0
2011-05-06 06:22:19 +02:00
Tobias Brunner
361f416d2c
The mutex of a thread has to be locked when destroying it.
2010-04-29 13:30:51 +02:00
Tobias Brunner
8b0e09103b
Adding DBG_LIB to all calls of libstrongswan's version of DBG*.
2010-04-06 12:47:40 +02:00
Andreas Steffen
b7fd2ea76c
corrected captions
2010-02-01 12:44:44 +01:00
Tobias Brunner
85202e8795
Added a workaround for the missing pthread_cancel on Android.
2009-12-23 17:03:42 +01:00
Tobias Brunner
0d5c6a28d5
Adding an object-oriented wrapper for threads.
2009-12-23 17:02:26 +01:00