rpetrich/RocketBootstrap — pull request #3 by mologie (2014-03-14 14:28:12+00:00)
Title: Add XPC support

Hello,

this patch adds support for XPC's C APIs to RocketBootstrap. The following public API have been added:

`rocketbootstrap_xpc_connection_apply` may be called on an XPC connection prior to calling `xpc_connection_resume`. Calls to bootstrap for this single XPC connection will then be intercepted and redirected to RocketBootstrap. This is archived by hooking an internal XPC method (which runs on another thread and calls `bootstrap_look_up`) and hooking the public cancel function in order to track object deletion.

`rocketbootstrap_xpc_connection_unlock` is a helper function which adds the Mach service name of an XPC service to RocketBootstrap's whitelist. This is only suitable for permanently running XPC services. In order to support on-demand starting, one should call `rocketbootstrap_unlock` on the Mach service's name from within SpringBoard's context or from another permanently-running and privileged process.

I have only had the chance to test these additions on an iPhone 5 and iPad Air, both running iOS 7.0.6. The API and internals of XPC's C API however remained mostly unchanged from iOS 6 to 7 and I have designed the hooking routine to fail gracefully when something goes wrong.

The patch also changes RocketBootstrap's protocol and look_up implementation in order to use bootstrap_look_up3, which is required for using some of XPC's features such as the privileged service flag. This change is backwards-compatible to the previous implementation.

Please review and merge this patch. I would like to, if accepted, release a tweak depending on these changes soon.

Oliver