zephyr/arch/posix
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
..
core posix arch: Fix very rare segfault on program termination 2023-07-27 17:02:36 +02:00
include arch POSIX: Refactor into a top and bottom 2023-06-23 12:16:26 +02:00
CMakeLists.txt posix arch cmake: Add clarification on use of target_link_options 2023-07-10 09:51:25 +02:00
Kconfig arch/posix: put fuzzing kconfigs into submenu 2023-07-18 19:19:53 +00:00
Linux.aarch64.cmake scripts: move user_wordsize.py to scripts/build/user_wordsize.py 2022-07-12 10:03:45 +02:00