]> git.ipfire.org Git - thirdparty/openssl.git/commit
Make rcu_thread_key context-aware
authorNeil Horman <nhorman@openssl.org>
Mon, 15 Apr 2024 20:56:29 +0000 (16:56 -0400)
committerTomas Mraz <tomas@openssl.org>
Thu, 20 Jun 2024 14:54:40 +0000 (16:54 +0200)
commit83efcfdfa1de760bd30df7f4cf94e7a0d2b0db9f
tree42569379adc22d837f6f8a1e2b35c093d59f3e18
parenta13df68796828794920403c31d77409b0f06bae0
Make rcu_thread_key context-aware

Currently, rcu has a global bit of data, the CRYPTO_THREAD_LOCAL object
to store per thread data.  This works in some cases, but fails in FIPS,
becuase it contains its own copy of the global key.

So
1) Make the rcu_thr_key a per-context variable, and force
   ossl_rcu_lock_new to be context aware

2) Store a pointer to the context in the lock object

3) Use the context to get the global thread key on read/write lock

4) Use ossl_thread_start_init to properly register a cleanup on thread
   exit

5) Fix up missed calls to OSSL_thread_stop() in our tests

(cherry picked from commit 24d16d3a1915a06a2130385a87de9a37fc09c4b9)

Fixes #24581

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24630)
crypto/conf/conf_mod.c
crypto/context.c
crypto/threads_none.c
crypto/threads_pthread.c
crypto/threads_win.c
doc/internal/man3/ossl_rcu_lock_new.pod
include/internal/cryptlib.h
include/internal/rcu.h
test/threadstest.c
test/threadstest.h