SIGSEV in thr_malloc_lock() via __Tthr_mutex_init()

Dave Baukus daveb at spectralogic.com
Mon Oct 5 17:21:00 UTC 2020


On FreeBSD stable12, the testparm utility of a local build of samba413
accesses an invalid curthread as returned from _get_curthread().

Breakpoint 2, thr_malloc_lock (curthread=0x802c057d0) at lib/libthr/thread/thr_malloc.c:64
64              if (curthread == NULL)
(gdb) bt
#0  thr_malloc_lock (curthread=0x802c057d0) at lib/libthr/thread/thr_malloc.c:66
#1  __thr_calloc (num=1, size=96) at lib/libthr/thread/thr_malloc.c:88
#2  0x00000008014330a3 in mutex_init (mutex=0x80106f008, mutex_attr=<optimized out>, calloc_cb=<optimized out>) at lib/libthr/thread/thr_mutex.c:295
#3  __Tthr_mutex_init (mutex=0x80106f008, mutex_attr=<optimized out>) at lib/libthr/thread/thr_mutex.c:395
#4  0x000000080203ef2c in gnutls_system_mutex_init () from /usr/local/lib/libgnutls.so.30
#5  0x0000000802038773 in _gnutls_global_init () from /usr/local/lib/libgnutls.so.30
#6  0x0000000802038b37 in lib_init () from /usr/local/lib/libgnutls.so.30
#7  0x000000080103564d in ?? () from /libexec/ld-elf.so.1
#8  0x0000000801050b00 in ?? ()

thr_malloc_lock() will core when it attempts curthread->locklevel++
because curthread (0x802c057d0) is in a RO section of libnettle:

(gdb)  info proc mappings

process 40081
Mapped address spaces:

            Start Addr           End Addr       Size     Offset Flags   File
... 8< snip
           0x802c03000        0x802c1f000    0x1c000        0x0  r-- CN-- /usr/local/lib/libnettle.so.8.0
           0x802c1f000        0x802c40000    0x21000    0x1c000  r-x CN-- /usr/local/lib/libnettle.so.8.0

Anyone have a clue as to what's going on or a suggestion on what may be wrong with my build ?
Thanks

-- 
Dave Baukus


More information about the freebsd-threads mailing list