Skip to content

disable fork-malloc-exec for non-glibc-systems

Jean-Louis Fuchs requested to merge jeanlf/dbus:glibc into master

Calling malloc() after fork is undefined behaviour if the process is multi-threaded. locks held by a thread on fork() will never be released. malloc() is usally protected by a lock and can therefore deadlock. glibc is known not to deadlock in this case.

This commit does not rule out other problems on glibc-systems, but fixes an issue on musl-libc-systems. Only restricting to async-signal safe functions between fork() and exec() prevents undefined behaviour for sure. See signal-safety(7)

Edited by Jean-Louis Fuchs

Merge request reports