Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for relative call instructions in reentry island #17

Open
wants to merge 2 commits into
base: semver-1.x
Choose a base branch
from

Conversation

noahd
Copy link

@noahd noahd commented May 15, 2014

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):
pkgspacegetname


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 in localFunction() get optimized away and the relative load instruction for __FUNCTION__ is copied as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant