[openssl/openssl] bd1d49: fixes crash on NetBSD

0 views
Skip to first unread message

nikolapajkovsky

unread,
2:29 PM (8 hours ago) 2:29 PM
to openssl...@openssl.org
Branch: refs/heads/openssl-3.5
Home: https://github.com/openssl/openssl
Commit: bd1d498d7eff6da061ad79e34384eb895025f6e1
https://github.com/openssl/openssl/commit/bd1d498d7eff6da061ad79e34384eb895025f6e1
Author: Nikola Pajkovsky <nik...@openssl.org>
Date: 2026-02-07 (Sat, 07 Feb 2026)

Changed paths:
M crypto/initthread.c

Log Message:
-----------
fixes crash on NetBSD

commit 5bf627c977f7 introduced recursion_guard which is by default set
to -1 of CRYPTO_THREAD_ID type. NetBSD pthread_equal dereferences
pthread_t in order to check t1->pt_magic == PT_MAGIC. Setting to -1
is not wise, it's better to set it to 0. Dereferencing of the
pthread_t happens only if t1/t2 are not NULL.

NetBSD defines pthread_equal:

int
pthread_equal(pthread_t t1, pthread_t t2)
{
...
pthread__error(0, "Invalid thread",
(t1 != NULL) && (t1->pt_magic == PT_MAGIC));
...
/* Nothing special here. */
return (t1 == t2);
}

The problem only occurs only when ossl is compiled with threads on NetBSD.

Fixes #29828
Fixes: 5bf627c977f7 ("ensure destructor key is created prior to any other thread specific key")
Signed-off-by: Nikola Pajkovsky <nik...@openssl.org>

Reviewed-by: Neil Horman <nho...@openssl.org>
Reviewed-by: Saša Nedvědický <sas...@openssl.org>
Reviewed-by: Tomas Mraz <to...@openssl.org>
Reviewed-by: Tim Hudson <t...@openssl.org>
MergeDate: Sat Feb 7 18:20:07 2026
(Merged from https://github.com/openssl/openssl/pull/29952)

(cherry picked from commit 8bf997d8d061b9556485e57f810916f685033601)


Commit: 3355e7d080f418c810ec53ec5d5648a8fa3af02a
https://github.com/openssl/openssl/commit/3355e7d080f418c810ec53ec5d5648a8fa3af02a
Author: Nikola Pajkovsky <nik...@openssl.org>
Date: 2026-02-07 (Sat, 07 Feb 2026)

Changed paths:
M crypto/initthread.c
M crypto/threads_none.c

Log Message:
-----------
alternative solution

Signed-off-by: Nikola Pajkovsky <nik...@openssl.org>

Reviewed-by: Neil Horman <nho...@openssl.org>
Reviewed-by: Saša Nedvědický <sas...@openssl.org>
Reviewed-by: Tomas Mraz <to...@openssl.org>
Reviewed-by: Tim Hudson <t...@openssl.org>
MergeDate: Sat Feb 7 18:20:11 2026
(Merged from https://github.com/openssl/openssl/pull/29952)

(cherry picked from commit fdbbf3c26066389b1c4ffc0c4b7ff792bf340d7b)


Compare: https://github.com/openssl/openssl/compare/19bccb98a408...3355e7d080f4

To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications
Reply all
Reply to author
Forward
0 new messages