zephyr/arch/posix/core
Alberto Escolar Piedras c044b2e916 posix arch: Fix very rare segfault on program termination
In some very rare cases (< 1/1000 runs), in very loaded machines,
a race in the glibc pthread_cancel() seems to be triggered.

In this the cancelled thread cleanup overtakes the pthread_cancel()
code, and frees the pthread structure before pthread_cancel()
has finished, resulting in a dereference into already
free'd memory, and therefore a segfault.
Calling pthread_cancel() during cleanup is not required beyond
preventing a valgrind memory leak report (all threads will be
stopped immediately on exit).
Therefore we stop doing this, to avoid this very rare crashes.

This issue was reproduced in Ubuntu 22.04, with its default
gcc 11.3.0 and glibc 2.35.
The issue may also have been seen very rarely in Zephyr's CI.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-27 17:02:36 +02:00
..
nsi_compat native boards: Make native simulator host trampolines avaliable to all 2023-07-07 14:32:41 +02:00
offsets arch: posix: Remove unused offset symbols 2023-02-23 16:44:07 +01:00
CMakeLists.txt native boards: Make native simulator host trampolines avaliable to all 2023-07-07 14:32:41 +02:00
cpuhalt.c arch: migrate includes to <zephyr/...> 2022-05-06 19:57:22 +02:00
fatal.c arch: migrate includes to <zephyr/...> 2022-05-06 19:57:22 +02:00
irq.c include: add more missing zephyr/ prefixes 2022-05-27 15:20:27 -07:00
posix_core.c posix arch: Fix very rare segfault on program termination 2023-07-27 17:02:36 +02:00
posix_core_nsi.c arch POSIX: provide a bottom which uses natsim's thread emul 2023-07-05 07:01:19 -04:00
swap.c include: add more missing zephyr/ prefixes 2022-05-27 15:20:27 -07:00
thread.c arch POSIX: Refactor into a top and bottom 2023-06-23 12:16:26 +02:00