Add support for relative call instructions in reentry island #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the
fixupInstructions
function only relocates relative jump offsets and nothing else. This causes segfaults when calling the reentry islands of functions that contain relative call instructions in their first 5 bytes.If you're looking for a concrete example, check out the
PKGSpaceGet*
functions in CoreGraphics (they're only used in WindowServer and aren't exported, FYI):There are other types of instructions with relative offsets that also cause segfaults in reentry islands*, but I honestly don't feel adept enough at the moment to write a general solution, so I left it at that.
* Compiling
test_mach_override.cp
with clang yields crashes, for instance. I'm assuming that happens because the nops inlocalFunction()
get optimized away and the relative load instruction for__FUNCTION__
is copied as-is.