Summary: | Linuxulator: pthread_join crash | ||
---|---|---|---|
Product: | Base System | Reporter: | Alex S <iwtcex> |
Component: | kern | Assignee: | Edward Tomasz Napierala <trasz> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | emaste, trasz |
Priority: | --- | ||
Version: | 12.1-RELEASE | ||
Hardware: | amd64 | ||
OS: | Any | ||
Bug Depends on: | |||
Bug Blocks: | 247219 |
Description
Alex S
2020-07-23 19:23:40 UTC
Turns out pthread_join in glibc calls this bit of code [1]: if (__builtin_expect (stack_cache_actsize > stack_cache_maxsize, 0)) __free_stacks (stack_cache_maxsize); Consequently, `limit stacksize 8192` (the default value on Linux) gets rid of crash. [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/allocatestack.c;h=4ae4b5a9862f35f7f42ceb775094c85320203cce;hb=7ebd114211dcd290efd54e610bbde0765bd7764c#l312 Thanks for tracking this down! What a happy coincidence; I've been submitted a patch that adjusts Linux stack sizes to get the core dump size down to reasonable levels; seems like we'll be able to kill two birds with one stone. A commit references this bug: Author: trasz Date: Fri Oct 16 11:23:31 UTC 2020 New revision: 366756 URL: https://svnweb.freebsd.org/changeset/base/366756 Log: Set default stack size for Linux apps to 8MB. This matches Linux' defaults, makes core files smaller, and fixes applications which use pthread_join(3) in a wrong way, namely Steam. This is based on a patch submitted by Jason Yang, which I've reworked to set the limit instead of only changing the value reported (which is enough to fix the bug for Linux pthreads, but could be confusing). PR: 248225 Submitted by: Jason_YH_Yang at wistron.com (earlier version) Analyzed by: Alex S <iwtcex@gmail.com> Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26778 Changes: head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h It's already there in 13. |