Module Name:    src
Committed By:   martin
Date:           Sun Nov  3 11:41:57 UTC 2019

Modified Files:
        src/doc [netbsd-9]: HACKS
        src/external/bsd/jemalloc/include/jemalloc/internal [netbsd-9]:
            jemalloc_internal_defs.h
        src/external/bsd/jemalloc/lib [netbsd-9]: Makefile.inc

Log Message:
Pull up following revision(s) (requested by rin in ticket #392):

        doc/HACKS: revision 1.195
        doc/HACKS: revision 1.196
        external/bsd/jemalloc/lib/Makefile.inc: revision 1.11
        
external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h: 
revision 1.11

PR/54307: Rin Okuyama: Lots of jemalloc assertions in latest -current

Workaround for random crash of userland binaries, as reported in
PR port-alpha/54307.

If rtree.c and tcache.c are compiled with -O0, userland just works
without problems as far as I can see. Alternately, you can specify
-DJEMALLOC_DEBUG to avoid random crash. Smells like compiler bug,
or wrong coding which relies on some undefined behavior.

Anyway, we need to pull this up into netbsd-9 asap.

Describe workaround for PR port-alpha/54307.

Describe that both GCC 7.4 and 8.3 fail in the last entry.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.190.2.1 src/doc/HACKS
cvs rdiff -u -r1.10 -r1.10.4.1 \
    src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
cvs rdiff -u -r1.10 -r1.10.2.1 src/external/bsd/jemalloc/lib/Makefile.inc

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.190 src/doc/HACKS:1.190.2.1
--- src/doc/HACKS:1.190	Tue May 14 02:53:16 2019
+++ src/doc/HACKS	Sun Nov  3 11:41:57 2019
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.190 2019/05/14 02:53:16 maya Exp $
+# $NetBSD: HACKS,v 1.190.2.1 2019/11/03 11:41:57 martin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -929,3 +929,12 @@ file	src/libexec/ld.elf_so/Makefile: 1.1
 descr	Disable optimization for rtld.c on the vax with gcc-7. Crashes on the
 	second pass loop with elm == 0xffffffff
 kcah
+
+port	alpha
+hack	GCC 7.4/8.3: userland binaries crash randomly (port-alpha/54307)
+cdate	Fri Nov  1 20:43:35 UTC 2019
+who	rin
+file	src/external/bsd/jemalloc/lib/Makefile.inc: 1.11
+descr	rtree.c and tcache.c need to be compiled with -O0, alternatively,
+	you can compile whole jemalloc with -DJEMALLOC_DEBUG.
+kcah

Index: src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h:1.10 src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h:1.10.4.1
--- src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h:1.10	Tue May 14 16:22:09 2019
+++ src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h	Sun Nov  3 11:41:57 2019
@@ -47,9 +47,13 @@
  */
 #ifdef _LP64
 /* XXX: I will take care of this later */
-#define LG_VADDR 48
+# ifdef __alpha__
+#  define LG_VADDR 43	/* bit 42 indicates direct map, 42--63 are same */
+# else
+#  define LG_VADDR 48
+# endif
 #else
-#define LG_VADDR 32
+# define LG_VADDR 32
 #endif
 
 /* Defined if C11 atomics are available. */

Index: src/external/bsd/jemalloc/lib/Makefile.inc
diff -u src/external/bsd/jemalloc/lib/Makefile.inc:1.10 src/external/bsd/jemalloc/lib/Makefile.inc:1.10.2.1
--- src/external/bsd/jemalloc/lib/Makefile.inc:1.10	Tue Jul 23 06:31:20 2019
+++ src/external/bsd/jemalloc/lib/Makefile.inc	Sun Nov  3 11:41:57 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.10 2019/07/23 06:31:20 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.10.2.1 2019/11/03 11:41:57 martin Exp $
 
 JEMALLOC:=${.PARSEDIR}/..
 
@@ -51,6 +51,14 @@ COPTS.ctl.c+=-Wno-error=stack-protector
 COPTS.stats.c+=-Wno-error=stack-protector
 COPTS.tcache.c+=-Wno-error=stack-protector
 
+.if ${MACHINE} == "alpha"
+# These files need to be compiled with -O0, or build everything with
+# -DJEMALLOC_DEBUG. Otherwise, userland binaries crash randomly, as
+# reported in port-alpha/54307.
+COPTS.rtree.c+=-O0
+COPTS.tcache.c+=-O0
+.endif
+
 .if ${MACHINE_ARCH} == "vax"
 # in merge_overlapping_regs, at regrename.c
 COPTS.arena.c+=-O0

Reply via email to