this adds a dummy atomic release operation to update_qp, which
should make sure that the new value of reader_idx is visible in
get_hold_current_qp, directly after incrementing the users count.
Fixes: #26875
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26964)
(cherry picked from commit
4a1a7fe5ce088964010779e1f5a90560903ecc76)
ATOMIC_STORE_N(uint32_t, &lock->reader_idx, lock->current_alloc_idx,
__ATOMIC_RELAXED);
+ /*
+ * this should make sure that the new value of reader_idx is visible in
+ * get_hold_current_qp, directly after incrementing the users count
+ */
+ ATOMIC_ADD_FETCH(&lock->qp_group[current_idx].users, (uint64_t)0,
+ __ATOMIC_RELEASE);
+
/* wake up any waiters */
pthread_cond_signal(&lock->alloc_signal);
pthread_mutex_unlock(&lock->alloc_lock);