Crash in IOService::Create

I am getting an unexpected crash from IOService::Create() when attempting to create a new user-client. The crash is a nullptr exception in OSCopyInObjects(). The last call from my code was IOService::Create().

As far as I can tell, all the input parameters to Create() are correct, and the Info.plist is has the correct key and class information - indeed, if I corrupt these I get an error status return rather than a crash.

Any suggestions as to what could be causing this?

I suspect that the problem may be related from a change in the underlying application that is creating the user client. This was modified from a standard app to a daemon, following the advice here: https://developer.apple.com/documentation/xcode/signing-a-daemon-with-a-restricted-entitlement.

However, it is the driver that crashes - not the host opening the user client.

Answered by MarkII in 821769022

I think that I found the problem: if anything fails in the init() method of the user client object, rather than propagating the error back from Create(), DriverKit crashes.

Moral: UserClient init() methods must, at least for now, always succeed.

Accepted Answer

I think that I found the problem: if anything fails in the init() method of the user client object, rather than propagating the error back from Create(), DriverKit crashes.

Moral: UserClient init() methods must, at least for now, always succeed.

Crash in IOService::Create
 
 
Q