Post

Replies

Boosts

Views

Activity

Deadlock in AudioWorkIntervalCreate
Sometimes when I call AudioWorkIntervalCreate the call hangs with the following stacktrace. The call is made on the main thread. mach_msg2_trap 0x00007ff801f0b3ce mach_msg2_internal 0x00007ff801f19d80 mach_msg_overwrite 0x00007ff801f12510 mach_msg 0x00007ff801f0b6bd HALC_Object_AddPropertyListener 0x00007ff8049ea43e HALC_ProxyObject::HALC_ProxyObject(unsigned int, unsigned int, unsigned int, unsigned int) 0x00007ff8047f97f2 HALC_ProxyObjectMap::_CreateObject(unsigned int, unsigned int, unsigned int, unsigned int) 0x00007ff80490f69c HALC_ProxyObjectMap::CopyObjectByObjectID(unsigned int) 0x00007ff80490ecd6 HALC_ShellPlugIn::_ReconcileDeviceList(bool, bool, std::__1::vector<unsigned int, std::__1::allocator<unsigned int>>&, std::__1::vector<unsigned int, std::__1::allocator<unsigned int>>&) 0x00007ff8045d68cf HALB_CommandGate::ExecuteCommand(void () block_pointer) const 0x00007ff80492ed14 HALC_ShellObject::ExecuteCommand(void () block_pointer) const 0x00007ff80470f554 HALC_ShellPlugIn::ReconcileDeviceList(bool, bool) 0x00007ff8045d6414 HALC_ShellPlugIn::ConnectToServer() 0x00007ff8045d74a4 HAL_HardwarePlugIn_InitializeWithObjectID(AudioHardwarePlugInInterface**, unsigned int) 0x00007ff8045da256 HALPlugInManagement::CreateHALPlugIn(HALCFPlugIn const*) 0x00007ff80442f828 HALSystem::InitializeDevices() 0x00007ff80442ebc3 HALSystem::CheckOutInstance() 0x00007ff80442b696 AudioObjectAddPropertyListener_mac_imp 0x00007ff80469b431 auoop::WorkgroupManager_macOS::WorkgroupManager_macOS() 0x00007ff8040fc3d5 auoop::gWorkgroupManager() 0x00007ff8040fc245 AudioWorkIntervalCreate 0x00007ff804034a33
2
0
523
May ’24
How should NewUserClient be implemented?
I am trying to interact with a dext from an application. I am able to find the service using `IOServiceOpen` and I get a call to `NewUserClient` of my dext (I can see the `type` parameter passed being output in the log). After this I am a bit lost. Reading here about NewUserClient I can see that one should use Create to create a new Service object.The Discussion part here says "The keys in the propertiesKey dictionary describe the new service." Should this dictionary be placed in the plist file for the system extension as a top level entry, or should the dictionary be placed with the key in IOKitPersonalities? Can I leave the "IOServiceDEXTEntitlements" key with an ampty value to not imposte any restrictions about entitlements on the application that is connecting to the system extension?My plist looks like this (with the "MyUserClientProperties" key / dict in two places).&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt; &lt;string&gt;$(DEVELOPMENT_LANGUAGE)&lt;/string&gt; &lt;key&gt;CFBundleExecutable&lt;/key&gt; &lt;string&gt;$(EXECUTABLE_NAME)&lt;/string&gt; &lt;key&gt;CFBundleIdentifier&lt;/key&gt; &lt;string&gt;$(PRODUCT_BUNDLE_IDENTIFIER)&lt;/string&gt; &lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt; &lt;string&gt;6.0&lt;/string&gt; &lt;key&gt;CFBundleName&lt;/key&gt; &lt;string&gt;$(PRODUCT_NAME)&lt;/string&gt; &lt;key&gt;CFBundlePackageType&lt;/key&gt; &lt;string&gt;$(PRODUCT_BUNDLE_PACKAGE_TYPE)&lt;/string&gt; &lt;key&gt;CFBundleShortVersionString&lt;/key&gt; &lt;string&gt;1.0&lt;/string&gt; &lt;key&gt;CFBundleVersion&lt;/key&gt; &lt;string&gt;1&lt;/string&gt; &lt;key&gt;MyUserClientProperties&lt;/key&gt; &lt;dict&gt; &lt;key&gt;IOClass&lt;/key&gt; &lt;string&gt;MyUserClient&lt;/string&gt; &lt;key&gt;IOUserClass&lt;/key&gt; &lt;string&gt;MyUserUSBInterfaceDriver&lt;/string&gt; &lt;key&gt;IOServiceDEXTEntitlements&lt;/key&gt; &lt;string&gt;&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;IOKitPersonalities&lt;/key&gt; &lt;dict&gt; &lt;key&gt;example_device&lt;/key&gt; &lt;dict&gt; &lt;key&gt;MyUserClientProperties&lt;/key&gt; &lt;dict&gt; &lt;key&gt;IOClass&lt;/key&gt; &lt;string&gt;MyUserClient&lt;/string&gt; &lt;key&gt;IOUserClass&lt;/key&gt; &lt;string&gt;MyUserUSBInterfaceDriver&lt;/string&gt; &lt;key&gt;IOServiceDEXTEntitlements&lt;/key&gt; &lt;string&gt;&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;CFBundleIdentifier&lt;/key&gt; &lt;string&gt;$(PRODUCT_BUNDLE_IDENTIFIER)&lt;/string&gt; &lt;key&gt;IOClass&lt;/key&gt; &lt;string&gt;IOUserService&lt;/string&gt; &lt;key&gt;IOProviderClass&lt;/key&gt; &lt;string&gt;IOUSBHostInterface&lt;/string&gt; &lt;key&gt;IOUserClass&lt;/key&gt; &lt;string&gt;MyUserUSBInterfaceDriver&lt;/string&gt; &lt;key&gt;IOUserServerName&lt;/key&gt; &lt;string&gt;sc.example.MyUserUSBInterfaceDriver&lt;/string&gt; &lt;key&gt;bConfigurationValue&lt;/key&gt; &lt;integer&gt;0x1&lt;/integer&gt; &lt;key&gt;bInterfaceNumber&lt;/key&gt; &lt;integer&gt;0x0&lt;/integer&gt; &lt;key&gt;idVendor&lt;/key&gt; &lt;integer&gt;0x123&lt;/integer&gt; &lt;key&gt;idProduct&lt;/key&gt; &lt;integer&gt;0x08&lt;/integer&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;key&gt;OSBundleUsageDescription&lt;/key&gt; &lt;string&gt;Example user space USB driver&lt;/string&gt; &lt;/dict&gt; &lt;/plist&gt;Do I need to pass SUPERDISPATCH as the last argument to "Create"?From "OSX and iOS kernel programming" chapter 5 page 81:The ingenuity of the I/O Kit design is that user client objects are themselves a driver object: the IOUserClient class inherits from IOService and, as with any other IOService instance, each user client has a provider class that, for a user client, is the instance of the driver that the application is controlling.While the above might only be correct for kext (?) I would assume that things work in the same way for a dext,From Create documenation: "Use the kIOUserClassKey key to specify the name of the custom IOService subclass that you want the system to instantiate."Why is another IOService class needed to be instantiated? What is the purpose of this class? Is it the provider for my class that inherits from IOUserClient? If so how can I make the instance of my driver (the one that implements NewUserClient) the provider?From Create documenation: "Use the kIOClassKey to specify the name of the custom IOUserClient subclass to return to clients of your service."Is the type of the class that will be created and assigned to the third argument of "Create"? If so, is that the one I should assign to the IOUserClient pointer passed to "NewUserClient"?kern_return_t IMPL(MyUserUSBInterfaceDriver, NewUserClient) { os_log(OS_LOG_DEFAULT, "%{public}d:", type); IOPropertyName propertiesKey = "MyUserClientProperties"; IOService* client; auto ret = Create(this, propertiesKey, &amp;client, SUPERDISPATCH); // Need to do more things here... return ret; }No matter what I try I always get an assert, but I cannot see what is causing it.3 com.apple.DriverKit 0x0000000102f2b24b __assert_rtn + 102 4 com.apple.DriverKit 0x0000000102f2c20a IOService::Create_Impl(IOService*, char const*, IOService**) (.cold.2) + 35 5 com.apple.DriverKit 0x0000000102f1766b IOService::Create_Impl(IOService*, char const*, IOService**) + 91 6 com.apple.DriverKit 0x0000000102f2668f IOService::Create_Invoke(IORPC, OSMetaClassBase*, int (*)(OSMetaClassBase*, IOService*, char const*, IOService**)) + 135 7 com.apple.DriverKit 0x0000000102f276d7 IOService::Create(IOService*, char const*, IOService**, int (*)(OSMetaClassBase*, IORPC)) + 267 8 sc.example.MyUserUSBInterfaceDriver 0x0000000102ee0c89 MyUserUSBInterfaceDriver::NewUserClient_Impl(unsigned int, IOUserClient**) + 313 (MyUserUSBInterfaceDriver.cpp:155)
1
0
1.1k
May ’20