OSSL_LIB_CTX_load_config() must not be called concurrently on same libctx
authorTomas Mraz <tomas@openssl.org>
Thu, 2 May 2024 15:31:22 +0000 (17:31 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 9 May 2024 07:20:58 +0000 (09:20 +0200)
The semantics of such concurrent call is not defined.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24275)

doc/man3/OSSL_LIB_CTX.pod
test/threadstest.c

index cf8bd8b067f1f4518a4aa65ecf95499d0e663de5..ad058041d8b4a0cea818744933e0ddd04a11e895 100644 (file)
@@ -85,7 +85,8 @@ library context.
 
 OSSL_LIB_CTX_load_config() loads a configuration file using the given I<ctx>.
 This can be used to associate a library context with providers that are loaded
-from a configuration.
+from a configuration. This function must not be called concurrently from
+multiple threads on a single I<ctx>.
 
 OSSL_LIB_CTX_free() frees the given I<ctx>, unless it happens to be the
 default OpenSSL library context.
index 9a961bb5c4cc3191588d731f85e47cd6bf9c0eaa..2d05255132d3b6f8e6dac5dd15b3ea7500975c7d 100644 (file)
@@ -1076,19 +1076,6 @@ static int test_obj_add(void)
                            1, default_provider);
 }
 
-static void test_lib_ctx_load_config_worker(void)
-{
-    if (!TEST_int_eq(OSSL_LIB_CTX_load_config(multi_libctx, config_file), 1))
-        multi_set_success(0);
-}
-
-static int test_lib_ctx_load_config(void)
-{
-    return thread_run_test(&test_lib_ctx_load_config_worker,
-                           MAXIMUM_THREADS, &test_lib_ctx_load_config_worker,
-                           1, default_provider);
-}
-
 #if !defined(OPENSSL_NO_DGRAM) && !defined(OPENSSL_NO_SOCK)
 static BIO *multi_bio1, *multi_bio2;
 
@@ -1275,7 +1262,6 @@ int setup_tests(void)
 #endif
     ADD_TEST(test_multi_load_unload_provider);
     ADD_TEST(test_obj_add);
-    ADD_TEST(test_lib_ctx_load_config);
 #if !defined(OPENSSL_NO_DGRAM) && !defined(OPENSSL_NO_SOCK)
     ADD_TEST(test_bio_dgram_pair);
 #endif