我在 macOS 11 上成功构建并运行了 Apple 的示例Communicateing Between a DriverKit Extension and a Client App,这意味着我可以安装 DEXT 并通过它的客户端控制它。虽然在 macOS 10.15.7 上,我可以构建它并安装 DEXT,但 DEXT 崩溃。
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]
但是当操作系统尝试运行 DEXT 时,它本身显然会崩溃:
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
注意:相同构建的二进制文件在 macOS 11 上运行良好。
我在使用 Xcode 12.4 (12D4e) 的 macOS 11.4 (20F71) 和 10.15.7 (19H1217) 上。理想情况下,DEXT 也应该在 macOS 10.15 上运行。
这是 macOS 10.15.7 上 DriverKit.framework 中的错误,还是我以不正确的方式设置项目?