Connection between client and DriverKit

In a project, I'm using the DriverKit(and HIDDriverKit) framework. I have encountered a problem in the connection between the client app and the driver, which is implemented by the "IOKit" framework. By calling the function "IOServiceGetMatchingServices" the value of "iterator" returns correctly and then communication with the driver is done. However, after releasing the version on the TestFlight, on some systems, the value of the "iterator" returned 0 and it is not possible to communicate with the driver. I checked the status of the activated driver with the command "systemextensionsctl list" and there are no problems on the driver side and the values of "Enabled" and "Active" are starred.

AppSandbox = True, SIP: enable

ret = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceNameMatching(dextIdentifier), &iterator);
if (ret != kIOReturnSuccess)
{
    goto fail;
}

while ((service = IOIteratorNext(iterator)) != IO_OBJECT_NULL) {
    ret = IOServiceOpen(service, mach_task_self(), 0, &connection);
    if(ret == kIOReturnSuccess)
    {
        break;
    }
    else 
    {
        syslog(LOG_WARNING, "IDmelonLog LIB: Can't open service");
    }
    IOObjectRelease(service);
}

Replies

I’m presuming this is on the Mac.

However, after releasing the version on the TestFlight, on some systems, the value of the "iterator" returned 0

I presume iterator is from the snippet you posted. In the failure case, what do you get for ret?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Yes, it's on Mac, and zero (kIOReturnSuccess) always returns for ret.

Add a Comment

did RegisterService succeed on all the systems?

  • I noticed this happening on a MacOS 12.

Add a Comment

Solved: By testing the app on macOS 12, we realized that, it is not possible to make the connection between the service and the driver if the Sandbox is TRUE. But on macOS 13 and later no need to Disable the Sandbox.

  • Edited: By adding the com.apple.security.temporary-exception.iokit-user-client-class entitlement it's solved.

Add a Comment