Replying to @DanielMicay @johnregehr and 3 others
Sources for this monstrosity are at https://hg.mozilla.org/mozilla-central/file/tip/mozglue/linker/…. Here's their function for monkey patching libc: https://hg.mozilla.org/mozilla-central/file/tip/mozglue/linker/ElfLoader.cpp#l1035…. Below that, you can see where they catch segfaults and trigger the library loading. They also measure signal latency to see if it's worth doing.