DriverKit matching, Kexts and Race Conditions?

With kexts, macOS would evaluate all candidate drivers and then load the most appropriate for the hardware.

But with dexts, what I observe is that all matching drivers are started. So for example, if I create two distinct dexts that will match to a USB device, both are loaded as well as any kext that also matches the device. This means that it appears to be impossible to implement the equivalent as a codeless kext in DriverKit.

How can I avoid this race condition, and ensure that the dext takes priority over a kext?

FWIW, in the specific case we have an external device that when placed in to an update mode gets assigned to the macOS Bluetooth driver (macOS 11.2 kext), which then try to use it as a wireless adapter. This stops our app from running and also breaks the Mac's Bluetooth connections in the process. We want to stop the Bluetooth stack from binding to this device.

Replies

The problem was caused by a spurious IOResourceMatch key in the dext IOKitPersonalities, left over from the initial Xcode project template. After deleting the key all seems ok (as you would expect!).


Hi Mark,

Matching behavior should be the same as well as conflict resolution. If you experience major deviations I'd expect that to be a bug and request a Feedback detailing the scenario.