TheDarkKnight
TheDarkKnight

Reputation: 27621

Running mach_inject with Qt in OSX Mountain Lion

On OSX Mountain Lion I'm able to compile mach_inject and the included test project. That works as expected with injection functioning perfectly.

I'm now trying to use the same mach_inject framework from a Qt project, compiled from QtCreator. I've tried both clang and gcc compilers.

Everything compiles and the application runs, but when calling mach_inject, I get the error:

mach_inject failing.. (os/kern) invalid address

Tracing mach_inject, the failure occurs at the last step, when it calls thread_create_running.

Does anyone know what the problem is here? I'm assuming it's something to do with the compiler options provided by Qt against those used by XCode, but could be totally wrong!

Upvotes: 0

Views: 351

Answers (1)

TheDarkKnight
TheDarkKnight

Reputation: 27621

The problem turned out to be a 32 / 64 bit incompatibility - as (naturally) you can't inject a 64bit bundle into a 32 bit app!

If anyone else has similar problems, debugging into the mach_inject_bundle_stub can be of use, as the same error from the kernel can be presented due to other issues.

Upvotes: 0

Related Questions