IOKit driver loaded but not running

I have a basic IOKit driver that is not hardware-launched and obtained from IOResources. it also provides the user class with the user class with help IOServiceOpen, but I think this is not related to my problem ... The main driver has an IOKit dependency, as indicated in the info file file file:

<key>OSBundleLibraries</key>
<dict>
    ...
    ..
    .
    <key>com.derived.driver</key>
    <string>1.0.0</string>
</dict> 

another driver (identified com.derived.driver) is implemented as a universal kernel extension and stored in /Library/Extensions.

When I load the base driver, the derivative is automatically loaded. since the resulting driver is located in /Library/Extensions, it can also be loaded before starting the derived driver with kextcache.

However, it stops working when I convert a derived driver from a generic to IOKit format, so now both drivers IOProviderClassmake up IOResources.

It seems that the derived driver simply refuses to run the IOService-based class with no signs of error in the output logs (I used the debugger and saw what it really does IOService::probeCandidates, but not IOService::startCandidate). kernel compiled with optimization, I could not put my finger for accurate flow).

When I look at the currently loaded drivers using kextstat, it seems that both drivers are loaded, but according to ioregonly the base driver has active instances (I expected both drivers to share the same provider that IOResources).

, , kexts (, - ).

IOProviderClass IOResources IOService.

<key>IOKitPersonalities</key>
<dict>
        <key>myDriver</key>
        <dict>
                <key>CFBundleIdentifier</key>
                <string>com.base.driver</string>
                <key>IOClass</key>
                <string>com_base_driver</string>
                <key>IOProviderClass</key>
                <string>com_derived_driver</string>

: , ( ioreg).

  +-o com_derived_driver  <class com_derived_driver, id 0x10000091f, registered, matched, active, busy 0 (804415 ms), retain 6>
    +-o com_base_driver  <class com_base_mng, id 0x100000920, registered, matched, active, busy 0 (0 ms), retain 9>

, , .

!

+4
1

, - , IOKit .

, , , IOService, . , , IOMatchCategory . IOResources , - . , , ?

, : Kernel Debug Kits (KDKs) , . - KDK readme, , .

+1

Source: https://habr.com/ru/post/1691677/


All Articles