bin/60633: cgdconfig missing pthread in ramdisk

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60633
>Category:       bin
>Synopsis:       cgdconfig missing pthread in ramdisk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 22 22:25:01 +0000 2026
>Originator:     ocb
>Release:        NetBSD 11.0
>Organization:
>Environment:
NetBSD server 11.0 NetBSD 11.0 (GENERIC) #0: Sat Aug 22 20:55:27 UTC 2026 build@live:/tmp/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
cgdconfig calculates parameters based on the running hardware and sets the parallelism value to the number of available cpu threads. however, the cgdconfig binary for ramdisk-cgdroot is built without pthread, so verification is executed on a single thread. benchmarks show that opening the same cgd drive with identical parameters takes 20 seconds from an installed system, but 220 seconds from the ramdisk.

needs a better patch than the temporary fix provided which only works.

additionally, after patching it appears siginfo returns information on sh process rather than cgdconfig.
>How-To-Repeat:
compare the time it takes to open the same cgd device on boot from the ramdisk against opening it from the installed system.
>Fix:
--- src/sbin/cgdconfig/Makefile.orig
+++ src/sbin/cgdconfig/Makefile
@@ -23,7 +23,7 @@
 .if ${MKARGON2} != "no"
 SRCS+=	argon2_utils.c
 CPPFLAGS+=	-DHAVE_ARGON2
-.if defined(CRUNCHEDPROG)
+.if defined(CRUNCHEDPROG) && !defined(CRUNCHEDPTHREAD)
 ARGON2_NO_THREADS=1
 .endif
 .include "${NETBSDSRCDIR}/external/apache2/argon2/lib/libargon2/Makefile.inc"

--- src/distrib/common/list.cgdroot.orig
+++ src/distrib/common/list.cgdroot
@@ -5,6 +5,6 @@
 
 PROG	sbin/cgdconfig
 PROG	sbin/wsconsctl
-LIBS	-lcrypto
+LIBS	-lcrypto -lpthread
 
 COPY	${NETBSDSRCDIR}/distrib/common/cgdroot.rc etc/rc

--- src/distrib/amd64/ramdisks/ramdisk-cgdroot/Makefile.orig
+++ src/distrib/amd64/ramdisks/ramdisk-cgdroot/Makefile
@@ -4,6 +4,7 @@
 IMAGESIZE=	5000k
 IMAGEDEPENDS= 	
 CRUNCHENV=	INIT_CHROOT=1
+CRUNCHENV+=	CRUNCHEDPTHREAD=1
 SMALLPROG_INET6=1
 
 .include "${.CURDIR}/../common/Makefile.ramdisk"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.