NetBSD-Bugs archive

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

Re: bin/60150: named(8) crashes at startup on NetBSD/i386 11.0_RC2



>  It might actually be the max_align_t value on i386 at the core of this issue
>  as I found out some years back.

It looks the problem is not "sizeof(max_align_t) on i386 is 12 bytes"
but "upstream lib/isc/jemalloc_shim.h (local implementation of
non-standard mallocx() and variants) assumes sizeof(max_align_t)
is power of 2 (or multiple of 8)".

Using in-tree jemalloc(3) by enabling HAVE_JEMALLOC explicitly in
src/external/mpl/bind/include/config.h also fixes the problem
(I'm not sure why it has been disabled by default):

---

Index: Makefile.inc
===================================================================
RCS file: /cvsroot/src/external/mpl/bind/Makefile.inc,v
retrieving revision 1.17.2.1
diff -u -p -d -r1.17.2.1 Makefile.inc
--- Makefile.inc	25 Aug 2025 16:17:25 -0000	1.17.2.1
+++ Makefile.inc	4 Apr 2026 04:38:31 -0000
@@ -17,11 +17,14 @@ CWARNFLAGS.clang+=	-Wno-unused-value -Wn
 LIBUVDIR=	${NETBSDSRCDIR}/external/mit/libuv
 LIBUVOBJDIR!=   cd ${LIBUVDIR}/lib && ${PRINTOBJDIR}
 LIBURCUDIR=	${NETBSDSRCDIR}/external/lgpl2/userspace-rcu
+LIBJEMALLOCDIR=	${NETBSDSRCDIR}/external/bsd/jemalloc
 LIBURCUMBOBJDIR!=   cd ${LIBURCUDIR}/lib/liburcu-mb && ${PRINTOBJDIR}
 LIBURCUCDSOBJDIR!=   cd ${LIBURCUDIR}/lib/liburcu-cds && ${PRINTOBJDIR}
 LIBURCUCOMMONOBJDIR!=   cd ${LIBURCUDIR}/lib/liburcu-common && ${PRINTOBJDIR}
+LIBJEMALLOCOBJDIR!=   cd ${LIBJEMALLOC}/lib && ${PRINTOBJDIR}
 CPPFLAGS+=	-I${LIBUVDIR}/dist/include
 CPPFLAGS+=	-I${LIBURCUDIR}/dist/include -I${LIBURCUDIR}/include
+CPPFLAGS+=	-I${LIBJEMALLOCDIR}/include
 CFLAGS+=	-std=gnu18
 LINTFLAGS+=	-Ac11
 
@@ -61,6 +64,7 @@ LDADD+=		-L${LIBURCUMBOBJDIR} -lurcu-mb_
 LDADD+=		-L${LIBURCUCDSOBJDIR} -lurcu-cds_g
 LDADD+=		-L${LIBURCUCOMMONOBJDIR} -lurcu-common_g
 LDADD+=		-L${LIBUVOBJDIR} -luv_g
+LDADD+=		-L${LIBJEMALLOCOBJDIR} -ljemalloc_g
 LDADD+=		-lexecinfo_g -lelf_g -lkvm_g -lz_g -lm_g
 .else
 LDADD+=		-lisccfg -ldns -lns
@@ -70,6 +74,7 @@ LDADD+=		-L${LIBURCUMBOBJDIR} -lurcu-mb
 LDADD+=		-L${LIBURCUCDSOBJDIR} -lurcu-cds
 LDADD+=		-L${LIBURCUCOMMONOBJDIR} -lurcu-common
 LDADD+=		-L${LIBUVOBJDIR} -luv
+LDADD+=		-L${LIBJEMALLOCOBJDIR} -ljemalloc
 LDADD+=		-lexecinfo -lelf -lkvm -lz -lm
 DPADD+=		${LIBISCCC} ${LIBISC}
 DPADD+=		${LIBUVOBJDIR}/libuv.a
Index: include/config.h
===================================================================
RCS file: /cvsroot/src/external/mpl/bind/include/config.h,v
retrieving revision 1.23.2.1
diff -u -p -d -r1.23.2.1 config.h
--- include/config.h	25 Aug 2025 16:17:26 -0000	1.23.2.1
+++ include/config.h	4 Apr 2026 04:38:33 -0000
@@ -225,10 +225,10 @@
 #define HAVE_INTTYPES_H 1
 
 /* Define to 1 if jemalloc is available */
-/* #undef HAVE_JEMALLOC */
+#define HAVE_JEMALLOC 1
 
 /* Define to 1 if you have the <jemalloc/jemalloc.h> header file. */
-/* #undef HAVE_JEMALLOC_JEMALLOC_H */
+#define HAVE_JEMALLOC_JEMALLOC_H 1
 
 /* Use json-c library */
 /* #undef HAVE_JSON_C */

---
Izumi Tsutsui




Home | Main Index | Thread Index | Old Index