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

macOS support #99

Open
jab opened this issue Dec 23, 2018 · 5 comments
Open

macOS support #99

jab opened this issue Dec 23, 2018 · 5 comments

Comments

@jab
Copy link

jab commented Dec 23, 2018

Since #83 (just titled "Mac") was closed via fe7a276, it's apparent that that issue was about failing with a better error message. Since it looks like there's no other issue tracking Mac support, I figured I'd create this one.

Thanks for releasing reptyr!

@james-see
Copy link

Seconding this. Would like support and wondering the LoE on doing this, seems like the Makefile could be adjusted to check and support the right gcc or am I missing something?

@kevans91
Copy link
Contributor

@jamesacampbell Unfortunately it's a bit more involved than that- reptyr gets pretty deep into kernel debugging facilities that vary, usually quite wildly, from kernel-to-kernel. In the Mac OS case, they seem to have a very limited form of ptrace(2) inherited from *BSD, but it contains almost none of the necessary functionality to be useful. You're looking at writing platform shims that look like ptrace to reptyr (because that part is abstracted away in platform/ glue) but use whatever facility MacOS provides at a minimum. =(

@james-see
Copy link

@kevans91 thanks for that, I definitely was missing that context. That seems like a heavy lift.

@cooljeanius
Copy link

@jamesacampbell Unfortunately it's a bit more involved than that- reptyr gets pretty deep into kernel debugging facilities that vary, usually quite wildly, from kernel-to-kernel. In the Mac OS case, they seem to have a very limited form of ptrace(2) inherited from *BSD, but it contains almost none of the necessary functionality to be useful. You're looking at writing platform shims that look like ptrace to reptyr (because that part is abstracted away in platform/ glue) but use whatever facility MacOS provides at a minimum. =(

The macOS ptrace calls seem to work well enough for the macOS port of GDB; what does reptyr need to do with ptrace that gdb doesn't?

@kevans91
Copy link
Contributor

@jamesacampbell Unfortunately it's a bit more involved than that- reptyr gets pretty deep into kernel debugging facilities that vary, usually quite wildly, from kernel-to-kernel. In the Mac OS case, they seem to have a very limited form of ptrace(2) inherited from *BSD, but it contains almost none of the necessary functionality to be useful. You're looking at writing platform shims that look like ptrace to reptyr (because that part is abstracted away in platform/ glue) but use whatever facility MacOS provides at a minimum. =(

The macOS ptrace calls seem to work well enough for the macOS port of GDB; what does reptyr need to do with ptrace that gdb doesn't?

As far as I know, gdb's not typically executing syscalls in the victim context as we need to in reptyr. For some specific points, I don't really see any equivalent to PT_{GET,SET}REGS (which we'll use to replace syscall arguments and rewind to the original syscall instruction in conjunction with PT_TO_SCE/PT_TO_SCX to advance to the next syscall and then break when we execute it). I don't recall any specifics beyond that, I haven't really looked at this much in the intervening five years since the message you uoted.

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

No branches or pull requests

4 participants