Page 1 of 1

Using bootstrap_create_service with "new" iOS

PostPosted: Thu Dec 12, 2019 5:56 pm
by ccnut
Without going through the trouble of modifying the launchd plists to register a service I tried to use the (admittedly) deprecated bootstrap_* APIs for doing the registration at runtime. The Apple docs have the following for bootstrap_create_service:

Code: Select all
 * kern_return_t
 * bootstrap_create_service(mach_port_t bootstrap_port,
 *            name_t service_name,
 *            mach_port_t *service_port)
 * Creates a service named "service_name" and returns send rights to that
 * port in "service_port."  The port may later be checked in as if this
 * port were configured in the bootstrap configuration file.
 * Errors:   Returns appropriate kernel errors on rpc failure.
 *      Returns BOOTSTRAP_SERVICE_ACTIVE, if service already exists.

Great! So, call this function and then call bootstrap_check_in as other services do that went the plist route ... except that does not quite work. At runtime this function will return error 126, which is not documented anywhere. There are a few BOOTSTRAP_* contents defined in bootstrap.h, but not one for 126. Further, there are no kern_return_t values for 126 either.

As these things tend to be, I thought it might be an entitlement issue. I poked around the database and found these suspects:

Code: Select all

It seemed fitting that Apple locked down the registration mechanism and slapped an exception-based entitlement on them to protect their legacy stuff. But neither of these solved the problem. Is this API finally broken in iOS13 or is there another hidden entitlement somewhere? I've not tried this on any earlier iOS version yet.

There is also bootstrap_register that I might give a try since at least one entity is still using it (/System/Library/AccessibilityBundles/SpringBoard.axbundle/SpringBoard). Perhaps the other API is really dead?

Any thoughts

Re: Using bootstrap_create_service with "new" iOS

PostPosted: Sat Dec 14, 2019 1:04 am
by ccnut
Turns out bootstrap_register works. Not sure of the issue with the other. Still would be interested if anyone had any insights here.