openssl/include
Čestmír Kalina 4e43bc06f7 crypto: thread: serialize concurrent joins
Multiple concurrent joins with a running thread suffer from a race
condition that allows concurrent join calls to perform concurrent arch
specific join calls, which is UB on POSIX, or to concurrently execute
join and terminate calls.

As soon as a thread T1 exists, one of the threads that joins with T1
is selected to perform the join, the remaining ones await completion.
Once completed, the remaining calls immediately return. If the join
failed, another thread is selected to attempt the join operation.

Forcefully terminating a thread that is in the process of joining
another thread is not supported.

Common code from thread_posix and thread_win was refactored to use
common wrapper that handles synchronization.

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19433)
2022-10-21 12:44:56 +02:00
..
crypto crypto: add preemptive threading support 2022-10-17 09:45:39 +01:00
internal crypto: thread: serialize concurrent joins 2022-10-21 12:44:56 +02:00
openssl Fix make update 2022-10-20 17:19:02 +01:00