]> git.ipfire.org Git - thirdparty/openssl.git/commit
Make rcu_thread_key context-aware 24205/head 24209/head
authorNeil Horman <nhorman@openssl.org>
Mon, 15 Apr 2024 20:56:29 +0000 (16:56 -0400)
committerNeil Horman <nhorman@openssl.org>
Fri, 19 Apr 2024 13:22:53 +0000 (09:22 -0400)
commit24d16d3a1915a06a2130385a87de9a37fc09c4b9
tree2add2328ebad114d63abcc440f0cbf3325eda44b
parentfaa4a10ebe5095765262c0e3c711fca08026c3d4
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

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24162)
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