[Bug 234775] PTHREAD_STACK_MIN is too small on amd64

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jan 9 04:18:47 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234775

            Bug ID: 234775
           Summary: PTHREAD_STACK_MIN is too small on amd64
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: markj at FreeBSD.org

The following program segfaults on amd64:

#include <limits.h>
#include <pthread.h>

static void *
fn(void *arg __unused)
{

        return (NULL);
}

int
main(void)
{
        pthread_t t;
        pthread_attr_t attr;

        (void)pthread_attr_init(&attr);
        (void)pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);

        (void)pthread_create(&t, &attr, fn, NULL);
        (void)pthread_join(t, NULL);

        return (0);
}

We end up crashing when the thread exits:

(gdb) bt
#0  symlook_obj1_gnu (req=0x7fffdfffd070, obj=0x80022a000) at
/home/mark/src/freebsd-dev/libexec/rtld-elf/rtld.c:4463
#1  symlook_obj (req=0x7fffdfffd070, obj=0x80022a000) at
/home/mark/src/freebsd-dev/libexec/rtld-elf/rtld.c:4272
#2  0x0000000800214357 in symlook_list (req=<optimized out>, dlp=<optimized
out>, objlist=<optimized out>)
    at /home/mark/src/freebsd-dev/libexec/rtld-elf/rtld.c:4197
#3  symlook_global (req=0x7fffdfffd6d0, donelist=0x7fffdfffd1c0) at
/home/mark/src/freebsd-dev/libexec/rtld-elf/rtld.c:4091
#4  0x000000080020dd3c in symlook_default (req=0x7fffdfffd6d0,
refobj=0x80022a800) at /home/mark/src/freebsd-dev/libexec/rtld-elf/rtld.c:4148
#5  0x000000080020ea73 in do_dlsym (handle=0xfffffffffffffffe, name=0x80025049b
"_Unwind_ForcedUnwind", retaddr=0x800263dbe <_pthread_exit_mask+158>, 
    ve=0x0, flags=<error reading variable: Cannot access memory at address
0x2>) at /home/mark/src/freebsd-dev/libexec/rtld-elf/rtld.c:3503
#6  0x0000000800263dbe in thread_uw_init () at
/home/mark/src/freebsd-dev/lib/libthr/thread/thr_exit.c:82
#7  _pthread_exit_mask (status=0x0, mask=0x0) at
/home/mark/src/freebsd-dev/lib/libthr/thread/thr_exit.c:243
#8  0x0000000800263d1b in _pthread_exit (status=0x7fffdfffd070) at
/home/mark/src/freebsd-dev/lib/libthr/thread/thr_exit.c:208
#9  0x000000080025675e in thread_start (curthread=0x80100a500) at
/home/mark/src/freebsd-dev/lib/libthr/thread/thr_create.c:291
#10 0x0000000000000000 in ?? ()

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list