NetBSD Problem Report #60244

From dogcow@babymeat.com  Sun May 10 04:40:56 2026
Return-Path: <dogcow@babymeat.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 34C5F1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 10 May 2026 04:40:56 +0000 (UTC)
Message-Id: <20260510042706.4B830E93A2@flippy.babymeat.com>
Date: Sat, 09 May 2026 23:27:06 -0500 (CDT)
From: dogcow@babymeat.com
Reply-To: dogcow@babymeat.com
To: gnats-bugs@NetBSD.org
Subject: openssl 3.5.6 pullup can emit pthread warnings on init
X-Send-Pr-Version: 3.95
X-From4GNATS: "dogcow@babymeat.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60244
>Category:       lib
>Synopsis:       openssl 3.5.6 pullup can emit pthread warnings on init
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 10 04:45:00 +0000 2026
>Closed-Date:    Fri Jun 26 03:16:02 +0000 2026
>Last-Modified:  Fri Jun 26 03:16:02 +0000 2026
>Originator:     dogcow@babymeat.com
>Release:        NetBSD 11.0_RC3
>Organization:

>Environment:


System: NetBSD flippy.babymeat.com 11.0_RC3 NetBSD 11.0_RC3 (FLIPPY) #2: Sat May 9 15:00:33 CDT 2026 dogcow@flippy.babymeat.com:/crap/obj/hg11obj/src/hg/11src/sys/arch/amd64/compile/FLIPPY amd64
Architecture: x86_64
Machine: amd64
>Description:

After the openssl 3.5.6 pullup, programs that invoke openssl (in various ways)
cause pthread warnings to be emitted when PTHREAD_DIAGASSERT=Ae is set:

Error detected by libpthread: Invalid thread.
Detected by file "/src/hg/11src/lib/libpthread/pthread.c", line 772, function "pthread_equal".

normally, this is just screen chatter, but will dump core with
PTHREAD_DIAGASSERT=a set.
>How-To-Repeat:

`PTHREAD_DIAGASSERT=Ae /usr/bin/host` 
the backtrace from when PTHREAD_DIAGASSERT is set to a:

#1  0x000078e58ba245a1 in pthread.errorfunc () from /usr/lib/libpthread.so.1
#2  0x000078e58ba24df9 in pthread_equal () from /usr/lib/libpthread.so.1
#3  0x000078e58b6aaa5a in ossl_init_thread () from /usr/lib/libcrypto.so.16
#4  0x000078e58b6aaec5 in ?? () from /usr/lib/libcrypto.so.16
#5  0x000078e58ba1f711 in pthread_once () from /usr/lib/libpthread.so.1
#6  0x000078e58b6a6195 in CRYPTO_THREAD_run_once ()
   from /usr/lib/libcrypto.so.16
#7  0x000078e58b6ab0bc in OPENSSL_init_crypto () from /usr/lib/libcrypto.so.16
#8  0x000078e58b18d928 in OPENSSL_init_ssl () from /usr/lib/libssl.so.16
#9  0x000078e58bb0441d in isc.tls_initialize () from /usr/lib/libisc.so.23

note that other programs - eg pkgsrc's `transmission-show` or `python -m
hashlib` have other code paths that eventually invoke ossl_init_thread
>Fix:

it is unclear whether this is merely cosmetic (ie, don't set
PTHREAD_DIAGASSERT) or if this is indicating some actual issue with the
newly pulled-up openssl

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->analyzed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 12 May 2026 21:36:58 +0000
State-Changed-Why:
OpenSSL's use of pthread_equal is UB, as reported upstream:
https://github.com/openssl/openssl/issues/31166


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60244 CVS commit: src/crypto/external/apache2/openssl/dist
Date: Wed, 13 May 2026 02:28:11 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed May 13 02:28:11 UTC 2026

 Modified Files:
 	src/crypto/external/apache2/openssl/dist/crypto: initthread.c
 	    threads_none.c threads_pthread.c threads_win.c
 	src/crypto/external/apache2/openssl/dist/include/internal: cryptlib.h

 Log Message:
 openssl: Disentangle thread-local initialization logic.

 https://github.com/openssl/openssl/issues/31166
 https://github.com/openssl/openssl/pull/31167
 PR lib/60244: openssl 3.5.6 pullup can emit pthread warnings on init


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 \
     src/crypto/external/apache2/openssl/dist/crypto/initthread.c
 cvs rdiff -u -r1.1.1.3 -r1.2 \
     src/crypto/external/apache2/openssl/dist/crypto/threads_none.c \
     src/crypto/external/apache2/openssl/dist/crypto/threads_win.c
 cvs rdiff -u -r1.5 -r1.6 \
     src/crypto/external/apache2/openssl/dist/crypto/threads_pthread.c
 cvs rdiff -u -r1.1.1.2 -r1.2 \
     src/crypto/external/apache2/openssl/dist/include/internal/cryptlib.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 18 May 2026 23:04:47 +0000
State-Changed-Why:
probably needs pullup-11, but inapplicable to netbsd-10 or netbsd-9


State-Changed-From-To: needs-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 26 Jun 2026 03:16:02 +0000
State-Changed-Why:
fixed in HEAD, fixed upstream, upstream update pulled up
inapplicable <11, so we're done!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.