Search code examples
c++macosdriverkitmacos-system-extension

DEXT crashes on macOS 10.15.7


I successfully built and ran Apple's sample Communicateing Between a DriverKit Extension and a Client App on macOS 11, meaning I can install the DEXT and also control it via it's client. On macOS 10.15.7 though, I can build it and install the DEXT, but the DEXT crashes.

The output of systemextensionsclt:

systemextensionsctl list
1 extension(s)
--- com.apple.system_extension.driver_extension enabled active  teamID  bundleID (version)  name    [state]
*   *   -   com.example.apple-samplecode.dext-to-user-client.driver (1.0/1) com.example.apple-samplecode.dext-to-user-client.driver [activated enabled]

But the DEXT itself obviously crashes when the OS tries to run it:

Dyld Error Message:
  Symbol not found: __ZN8OSAction18CreateWithTypeNameEP8OSObjectyymP8OSStringPPS_
  Referenced from: /Library/SystemExtensions/*/com.example.apple-samplecode.dext-to-user-client.driver (which was built for Mac OS X 19.0)
  Expected in: /System/DriverKit/System/Library/Frameworks/DriverKit.framework/DriverKit

Thread 2 Crashed:: Dispatch queue: NullDriverUserClient-Default
0   dyld                            0x000000011bb05ede __abort_with_payload + 10
1   dyld                            0x000000011bb2f55d abort_with_payload_wrapper_internal + 80
2   dyld                            0x000000011bb2f58f abort_with_payload + 9
3   dyld                            0x000000011bb2cbf4 dyld::halt(char const*) + 463
4   dyld                            0x000000011bab4bc3 dyld::fastBindLazySymbol(ImageLoader**, unsigned long) + 140
5   libdyld.dylib                   0x000000010dcf5936 dyld_stub_binder + 282
6   ???                             0x000000010da6f1a0 0 + 4524011936
7   com.example.apple-samplecode.dext-to-user-client.driver 0x000000010da64c41 NullDriverUserClient::Start_Impl(IOService*) + 705 (NullDriverUserClient.cpp:223)
8   com.apple.DriverKit             0x000000010dae09e4 IOService::Start_Invoke(IORPC, OSMetaClassBase*, int (*)(OSMetaClassBase*, IOService*)) + 86
9   com.example.apple-samplecode.dext-to-user-client.driver 0x000000010da67f75 NullDriverUserClient::_Dispatch(NullDriverUserClient*, IORPC) + 293 (NullDriverUserClient.iig.cpp:180)
10  com.example.apple-samplecode.dext-to-user-client.driver 0x000000010da67e3d NullDriverUserClient::Dispatch(IORPC) + 77 (NullDriverUserClient.iig.cpp:167)
11  com.apple.DriverKit             0x000000010dacd241 invocation function for block in OSMetaClassBase::Invoke(IORPC) + 117

Note: The binaries of this same build work fine on macOS 11.

I'm on macOS 11.4 (20F71) and 10.15.7 (19H1217) using Xcode 12.4 (12D4e). The DEXT ideally should also run on macOS 10.15.

Is this a bug in the DriverKit.framework on macOS 10.15.7 or did I set up the project in an incorrect way?


Solution

  • The missing symbol __ZN8OSAction18CreateWithTypeNameEP8OSObjectyymP8OSStringPPS_ refers to OSAction::CreateWithTypeName(OSObject*, unsigned long long, unsigned long long, unsigned long, OSString*, OSAction**). This function is only available from Big Sur/macOS 11.0/DriverKit 20.0 onwards.

    You should probably use the autogenerated Create function for the OSAction for your callback type, otherwise use the older OSAction::Create function.