rentzsch/mach_inject

Yosemite compatibility?

ni4 opened this issue · 9 comments

ni4 commented

Hi. I tried mach_inject + some Finder integration code on Mac OS X 10.10 Yosemite (Beta6) - and it fails in injected thread, on the first fopen/freopen/fwrite function call.
Everything works fine on Mavericks.

Anyone more experienced tried to run mach_inject on Yosemite? Or, somebody can recommend a way to debug this issue?
Thanks, all input is appreciated.

Hello,

I have the same issue, do you have the following error??

com.apple.xpc.launchd1: Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.ReportCrash
Sep 3 17:03:33 iMac-de-admin com.apple.xpc.launchd1: Service exited due to signal: Segmentation fault: 11

Applications which use this, like dropbox is not working.

do you find a way to fix or debut that ??

Thanks,

ni4 commented

I have just a segmentation fault in inject code, but most likely it's the same problem as yours.
Unfortunately, do not have a way to fix it at the moment - focused on other tasks.

Try removing the fprintf debugging code from INJECT_ENTRY in mach_inject_bundle_stub.c. It's ultimately trying to take out a pthread lock, but it's not safe to do so until we are inside pthread_entry

It's working back to normal !!!!

Thanks

ni4 commented

Thank you very much, it worked.
And it seems that without this modifications it was failing sometimes on 10.9, or am I wrong with this?
And, btw, why it worked on 10.9 and stopped to work at 10.10, any ideas?

Removing fprintf from INJECT_ENTRY fixed the problem for me as well. I'm not sure I understand what pthread lock it was trying to take out? Can you explain? Thanks @iccir

Effectively, when we are in INJECT_ENTRY, we are in a very hostile environment and limited in what we can call. We have no idea what the state of the rest of the app is, and are limited to calling async-safe APIs.

See Landon Fuller's excellent article for more information about this: http://landonf.bikemonkey.org/code/objc/Reliable_Crash_Reporting.20110912.html

I can't remember the exact backtrace in the crash log, but fprintf() was calling into other functions which eventually tried to take out a lock, and hit an assertion in the pthread code.

It was fixed(hopefully) in #14
Should we close this issue?

ni4 commented

Yes, I think it can be closed now.