From: Matt Caswell Date: Tue, 8 Mar 2022 17:04:59 +0000 (+0000) Subject: Some platforms don't have pthread_atfork X-Git-Tag: openssl-3.2.0-alpha1~2875 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5979596247a73d1aec7310e4da0b6023ffd79623;p=thirdparty%2Fopenssl.git Some platforms don't have pthread_atfork We've had a report of a linker failure on some platforms (this one was linux ARM) that apparently did not have pthread_atfork. It's strange that this has not been reported before but the simplest solution is just to remove this from the library since it isn't really used anyway. Currently it is called to set up the fork handlers OPENSSL_fork_prepare, OPENSSL_fork_parent and OPENSSL_fork_child. However all of those functions are no-ops. This is a remnant from earlier code that got removed. We can safely remove it now. Reviewed-by: Tomas Mraz Reviewed-by: Tim Hudson Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17842) --- diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c index 9f00d8be5ea..2b7280c09c4 100644 --- a/crypto/threads_pthread.c +++ b/crypto/threads_pthread.c @@ -261,26 +261,9 @@ int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock) return 1; } # ifndef FIPS_MODULE -# ifdef OPENSSL_SYS_UNIX - -static pthread_once_t fork_once_control = PTHREAD_ONCE_INIT; - -static void fork_once_func(void) -{ -# ifndef OPENSSL_NO_DEPRECATED_3_0 - pthread_atfork(OPENSSL_fork_prepare, - OPENSSL_fork_parent, OPENSSL_fork_child); -# endif -} -# endif - int openssl_init_fork_handlers(void) { -# ifdef OPENSSL_SYS_UNIX - if (pthread_once(&fork_once_control, fork_once_func) == 0) - return 1; -# endif - return 0; + return 1; } # endif /* FIPS_MODULE */