Description
I do realize this is likely to be ignored, but I just cannot let go of bringing it up anyway...
It appears to me that rust in certain circumstances is relying on undefined behavior, in that it is in general a multi-threaded program, and will in many cases do fork(), and perform many non-trivial tasks between fork() and exec(). Some of these things have manifested themselves in run-time problems observed on NetBSD: (detected) deadlocks in ld.elf_so (resulting in abort), deadlocks related to malloc() manifesting as hangs etc. In NetBSD, the fork() man page contains this passage:
Child processes of a threaded program have additional restrictions, a
child must only call functions that are async-signal-safe. Very few
functions are asynchronously safe (the list may be found in sigaction(2))
and applications should make sure they call exec(3) as soon as possible.
A Linux/Debian man page for fork(2) also contains a similar passage:
* After a fork() in a multithreaded program, the child can safely call
only async-signal-safe functions (see signal-safety(7)) until such
time as it calls execve(2).
Even though I don't point to offending code here, I have it on good authority that this is the root cause of the issues we have been observing on NetBSD. Is there any chance that the rust code could have a make-over so as to not rely on undefined behavior in this aspect?