> Hi,
>
> the most recent pkgsrc openssl upgrade popped up on my radar, and
> I proceeded to do
>
> # cd /usr/pkgsrc/security/openssl
> # make replace (previous was 3.1.5, now no longer in use, but see below)
> # cd /usr/pkgsrc/www/apache24
> # make clean
> # grep -i openssl /etc/mk.conf
> # make apache24 link with pkgsrc openssl:
> PREFER_PKGSRC+= openssl
> # Prefer over built-in openssl:
> PREFER.openssl= pkgsrc
> # make replace
>
> and proceeded to restart apache, but to my surprise:
>
> # sh /etc/rc.d/apache restart
> Stopping apache.
> Starting apache.
> [1] Segmentation fault (core dumped) RC_PID= _rc_pid= _rc_original_stdout_fd= _rc_o...
> #
I pushed a quick fix for that. I see pthread_self() returns -1 on NetBSD for the main thread. In that case, the logic in crypto/initthread.c -> int ossl_init_thread(void) is incorrect.
I've changed "recursion_guard = (CRYPTO_THREAD_ID)0;"
Original code (introduced in 3.6.1):
static CRYPTO_ONCE ossl_init_thread_runonce = CRYPTO_ONCE_STATIC_INIT;
static CRYPTO_THREAD_ID recursion_guard = (CRYPTO_THREAD_ID)-1;
DEFINE_RUN_ONCE_STATIC(ossl_init_thread_once)
{
recursion_guard = CRYPTO_THREAD_get_current_id();
if (!CRYPTO_THREAD_init_local(&destructor_key.value,
init_thread_destructor))
return 0;
recursion_guard = (CRYPTO_THREAD_ID)0;
return 1;
}
int ossl_init_thread(void)
{
if (CRYPTO_THREAD_compare_id(recursion_guard,
CRYPTO_THREAD_get_current_id()))
return 1;
if (!RUN_ONCE(&ossl_init_thread_runonce, ossl_init_thread_once))
return 0;
return 1;
}