pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: New pkgsrc openssl -> apache24 crash




To: Havard Eidnes <he%NetBSD.org@localhost>

Subject: Re: New pkgsrc openssl -> apache24 crash

From: Adam <adam%netbsd.org@localhost>

Date: Wed, 28 Jan 2026 19:23:54 +0100


> 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;
}


References:

New pkgsrc openssl -> apache24 crash
From: Havard Eidnes




Prev by Date: New pkgsrc openssl -> apache24 crash

Previous by Thread: New pkgsrc openssl -> apache24 crash

Indexes:

reverse Date

reverse Thread

Old Index



Home | Main Index | Thread Index | Old Index