Skip to content

no_stack_overflow_on_drop tests fail on FreeBSD #967

Closed
@bjorn3

Description

@bjorn3

What version of regex are you using?

a9b2e02

Describe the bug at a high level.

The no_stack_overflow_on_drop tests crash on FreeBSD with SIGBUS followed by SIGSEGV. This happens while spawning the thread. I am pretty sure it overflows the stack. 1k of stack seem to be way too little for spawning a thread on FreeBSD. The smallest stack size for which I was able to make it work is 8k. Anything below either crashes or hangs.

What are the steps to reproduce the behavior?

Run cargo test -p regex-syntax on FreeBSD.

What is the actual behavior?

(gdb) run
Starting program: /tmp/cirrus-ci-build/download/regex/target/debug/deps/regex_syntax-872800c174f9b4f7 
warning: Could not load shared library symbols for [vdso].
Do you need "set solib-search-path" or "set sysroot"?
[New LWP 115642 of process 30733]

Thread 2 received signal SIGBUS, Bus error.
[Switching to LWP 115642 of process 30733]
0x00000008019775b4 in find_symdef (symnum=1266, refobj=refobj@entry=0x801993008, defobj_out=defobj_out@entry=0x7fffdfffd0c0, flags=flags@entry=1, cache=cache@entry=0x0, lockstate=lockstate@entry=0x7fffdfffd058) at /usr/src/libexec/rtld-elf/rtld.c:2031
2031        if (ELF_ST_BIND(ref->st_info) != STB_LOCAL) {
(gdb) bt
#0  0x00000008019775b4 in find_symdef (symnum=1266, refobj=refobj@entry=0x801993008, defobj_out=defobj_out@entry=0x7fffdfffd0c0, 
    flags=flags@entry=1, cache=cache@entry=0x0, lockstate=lockstate@entry=0x7fffdfffd058) at /usr/src/libexec/rtld-elf/rtld.c:2031
#1  0x00000008019773fc in _rtld_bind (obj=0x801993008, reloff=14856) at /usr/src/libexec/rtld-elf/rtld.c:1028
#2  0x0000000801972fbd in _rtld_bind_start () at /usr/src/libexec/rtld-elf/amd64/rtld_start.S:121
#3  0x0000000801bbcf9e in malloc_mutex_trylock_final (mutex=<optimized out>)
    at /usr/src/contrib/jemalloc/include/jemalloc/internal/mutex.h:159
#4  malloc_mutex_lock (tsdn=0x801e67090, mutex=<optimized out>) at /usr/src/contrib/jemalloc/include/jemalloc/internal/mutex.h:218
#5  tsd_add_nominal (tsd=0x801e67090) at jemalloc_tsd.c:92
#6  __je_tsd_state_set (tsd=tsd@entry=0x801e67090, new_state=new_state@entry=0 '\000') at jemalloc_tsd.c:193
#7  0x0000000801bbd2e7 in __je_tsd_fetch_slow (tsd=0x801e67090, minimal=<optimized out>) at jemalloc_tsd.c:285
#8  0x0000000801b6c34b in tsd_fetch_impl (init=true, minimal=false)
    at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:355
#9  tsd_fetch () at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:381
#10 imalloc (sopts=<optimized out>, dopts=<optimized out>) at jemalloc_jemalloc.c:2256
#11 __je_malloc_default (size=64) at jemalloc_jemalloc.c:2293
#12 0x00000008019bc284 in _thr_attr_init (attr=0x7fffdfffd290) at /usr/src/lib/libthr/thread/thr_attr.c:365
#13 0x0000000001713bf7 in std::sys::unix::thread::guard::current () at sysroot_src/library/std/src/sys/unix/thread.rs:861
#14 0x00000000014f9b62 in std::thread::Builder::spawn_unchecked_::{{closure}} ()
    at /tmp/cirrus-ci-build/download/sysroot/sysroot_src/library/std/src/thread/mod.rs:523
#15 0x00000000014b7b9d in core::ops::function::FnOnce::call_once{{vtable.shim}} ()
    at /tmp/cirrus-ci-build/download/sysroot/sysroot_src/library/core/src/ops/function.rs:250
#16 0x0000000001686fee in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once ()
    at /tmp/cirrus-ci-build/download/sysroot/sysroot_src/library/alloc/src/boxed.rs:1988
#17 0x0000000001686f8b in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once ()
    at /tmp/cirrus-ci-build/download/sysroot/sysroot_src/library/alloc/src/boxed.rs:1988
#18 0x000000000164ffed in std::sys::unix::thread::Thread::new::thread_start ()
    at sysroot_src/library/std/src/sys/unix/thread.rs:108
#19 0x00000008019be83a in thread_start (curthread=0x802212700) at /usr/src/lib/libthr/thread/thr_create.c:292

What is the expected behavior?

The test passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions