comex / inject_and_interpose

like mach_inject
127 stars 53 forks source link

Cannot inject in launchd #2

Open rtibdewal opened 13 years ago

rtibdewal commented 13 years ago

Hello Comex,

I am new to git so I emailed you directly. Sorry, I was not aware of process.

I had few observations. Thought I should share it with you. This injection system is working nice with all applications (like, itunes, firefox, skype, finder, dock.. etc) but it fails to inject in "launchd" process. Another observation is if I run injection on terminal in bash, it cannot inject in bash and if I run it in sh, it cannot inject in sh.

While debugging, it appears to fail in following line when during start of 3rd loop for exception.

    TRY(mach_msg_overwrite(NULL, MACH_RCV_MSG, 0, sizeof(msg), exc, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, (void *) &msg, sizeof(msg)));

Thank you, Rahul

comex commented 13 years ago

What is the error code?

rtibdewal commented 13 years ago

This may sound odd.

From last 2 days I was getting sigtrap error and sometimes call never returned from inject command and if I debuged EXC_BREAKPOINT (SIGTRAP) mostly around

TRY(mach_msg_overwrite(NULL, MACH_RCV_MSG, 0, sizeof(msg), exc, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, (void *) &msg, sizeof(msg)));

Where as today when I tried to inject in launchd so that I can give you the error codes, it worked.

May be its something related to environment. Just for your information I was using 10.6 OS X Server in VMware Fussion.

If you wish you can mark this issue closed and if I can reproduce the exact environment, I will open a new issue and will post it with complete error codes.

Thank you, Rahul

rtibdewal commented 13 years ago

Hi there,

I was able to reproduce above issue if I link against frameworks like Carbon, CoreFoundation or any of them. And then inject in Launchd.

Injection fails and control does not return back to you. Thus there is no error code.