From: Bernd Edlinger Date: Mon, 17 Feb 2025 04:53:09 +0000 (+0100) Subject: Access cb_items under write_lock in ossl_synchronize_rcu X-Git-Tag: openssl-3.3.4~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84b0a3a63c9fa29857be4c8c87fc1050d16338fc;p=thirdparty%2Fopenssl.git Access cb_items under write_lock in ossl_synchronize_rcu Fixes: 74a52ca9b793 "Don't use __ATOMIC_ACQ_REL on older compilers" Reviewed-by: Neil Horman Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26790) --- diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c index 2e2e6121214..06f1ea8855e 100644 --- a/crypto/threads_pthread.c +++ b/crypto/threads_pthread.c @@ -514,12 +514,10 @@ void ossl_synchronize_rcu(CRYPTO_RCU_LOCK *lock) uint32_t curr_id; struct rcu_cb_item *cb_items, *tmpcb; - /* - * __ATOMIC_ACQ_REL is used here to ensure that we get any prior published - * writes before we read, and publish our write immediately - */ - cb_items = ATOMIC_EXCHANGE_N(prcu_cb_item, &lock->cb_items, NULL, - __ATOMIC_ACQ_REL); + pthread_mutex_lock(&lock->write_lock); + cb_items = lock->cb_items; + lock->cb_items = NULL; + pthread_mutex_unlock(&lock->write_lock); qp = update_qp(lock, &curr_id);