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

            Bug ID: 248225
           Summary: Linuxulator: pthread_join crash
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: [email protected]
          Reporter: [email protected]

% cat pthread-crash.c
#define _GNU_SOURCE

#include <pthread.h>
#include <stdio.h>

static void* test(void* arg) {
  printf("%s started\n", __func__);
  return NULL;
}

int main() {

  pthread_t t;
  pthread_create(&t, NULL, test, NULL);

  void* val;

  pthread_join(t, &val);
  pthread_join(t, &val);

  return 0;
}
% /compat/linux/bin/gcc -Wall pthread-crash.c -pthread -o pthread-crash
% ./pthread-crash
test started
Segmentation fault (core dumped)

It should be noted, while calling pthread_join in that manner is explicitly
discouraged in both FreeBSD and Linux man pages, some programs (Steam) still
occasionally do this and this does not lead to crash on Linux.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to