Conversation

The other common use case is optimizing code size for NullPointerExceptions in managed languages: instead of littering every object access with a check and branch, just blindly dereference and fix things up in the signal handler.
1
2
The reason Firefox monkey patches Bionic is because they don't have access to this for their horrifying linker. I really think they just need to get rid of it and adopt the now standard support for mapping uncompressed libraries directly from the apk.
Quote Tweet
Replying to @DanielMicay @johnregehr and 3 others
Sources for this monstrosity are at hg.mozilla.org/mozilla-centra. Here's their function for monkey patching libc: hg.mozilla.org/mozilla-centra. 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.
I suppose that only matters if your goal is to emulate the overwritten instructions so that you can jump back to the original function, and they're just calling a reimplementation. I hope they don't have any null pointer exceptions, I guess?
1
Show replies