From: Bernd Edlinger Date: Mon, 8 Sep 2025 21:00:55 +0000 (+0200) Subject: Add one more trace message to the torture_rcu_high test X-Git-Tag: openssl-3.4.3~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aafc6e32690107932bd60b2118b512e75d1bd99a;p=thirdparty%2Fopenssl.git Add one more trace message to the torture_rcu_high test It is interesting that in the very rare cases, where this test failure has been observed so far, the rcu torture value went always backwards to 0. This could be either due to ossl_rcu_deref(&writer_ptr) returning NULL, or the initial value of "new = CRYPTO_zalloc(sizeof(uint64_t), NULL, 0)" still visible despite ossl_rcu_assign_ptr(&writer_ptr, &new) immediatley after the "*new = global_ctr++" statement. Add one additional trace message to find out what exactly happens here, when it happens again. Additionally, we do no longer initialize the new value to zero but something else, so it can also be detected. Related to #27267 Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/28487) (cherry picked from commit 17d5c9297ef6f6a4d72788082d6772deb7a18f24) --- diff --git a/test/threadstest.c b/test/threadstest.c index 8a9e607d2d1..38401911d87 100644 --- a/test/threadstest.c +++ b/test/threadstest.c @@ -321,7 +321,8 @@ static void writer_fn(int id, int *iterations) t1 = ossl_time_now(); for (count = 0; ; count++) { - new = CRYPTO_zalloc(sizeof(uint64_t), NULL, 0); + new = CRYPTO_malloc(sizeof(uint64_t), NULL, 0); + *new = (uint64_t)0xBAD; if (contention == 0) OSSL_sleep(1000); ossl_rcu_write_lock(rcu_lock); @@ -381,6 +382,8 @@ static void reader_fn(int *iterations) if (oldval > val) { TEST_info("rcu torture value went backwards! %llu : %llu", (unsigned long long)oldval, (unsigned long long)val); + if (valp == NULL) + TEST_info("ossl_rcu_deref did return NULL!"); rcu_torture_result = 0; } oldval = val; /* just try to deref the pointer */