Using bootstrap_create_service with "new" iOS

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

Using bootstrap_create_service with "new" iOS

Postby ccnut » Thu Dec 12, 2019 5:56 pm

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
com.apple.security.exception.mach-register.global-name
com.apple.security.exception.mach-register.local-name


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
ccnut
 
Posts: 12
Joined: Fri Mar 15, 2019 5:11 pm

Re: Using bootstrap_create_service with "new" iOS

Postby ccnut » Sat Dec 14, 2019 1:04 am

Turns out bootstrap_register works. Not sure of the issue with the other. Still would be interested if anyone had any insights here.
ccnut
 
Posts: 12
Joined: Fri Mar 15, 2019 5:11 pm


Return to Questions and Answers

Who is online

Users browsing this forum: No registered users and 1 guest