我们用 C 代码开发了一个小测试.app,它加载 (dlopen()) 一个简单的单函数 dylib 库(dylib 文件包含在 /Contents/Frameworks/ 下的 app Contents 中),其中 printf 的两个文本行到一个文本使用 xcode 12 在 /tmp/ 中的文件。
该应用程序(和内部的 dylib)使用与基于开发人员 ID 的证书绑定的配置文件进行签名。通过 Xcode 归档/导出工具的 UI,App 的运行时已针对 Developer ID(将在我们的网站上发布)进行了正确的强化、签名、公证和装订。
我们通过将它放在 /Applications/loadtest.app 下并通过双击执行它来验证它在我们的构建机器上是否有效( /tmp/loadtest.log 已创建并正确打印条目。)
一旦我们将它下载到另一台 macbook(使用 osx 11.4 运行)上,它就不会执行(从 GateKeeper 收到“您没有打开应用程序的权限”消息),并且会因“终止原因:命名空间代码签名,代码 0x1”而崩溃"(请参阅下面的完整故障转储)。
在新的 macbook 上使用 spctl 检查:
spctl -a -t exec -v /Applications/loadtest.app:
“/Applications/loadtest.app:接受的来源=经过公证的开发人员 ID”
我们已经尝试更改应用程序的权限和属性(在互联网上找到了一些提示),但它没有帮助。有人建议重启机器(让它重新协调苹果的公证服务并下载最新的装订“票”),这也没有帮助。
如果我们在该测试 MacBook 上禁用 SIP,则应用程序现在运行,而不是在我们从网守收到有关“未知发布者”的警告并允许它之前,但我们需要我们的应用程序在启用 SIP 的情况下运行。
有没有人有任何提示或建议?我们联系了苹果,但从那以后没有收到他们的任何答复。
...
Crash dump:
rocess: loadtest [582]
Path: /Applications/loadtest.app/Contents/MacOS/loadtest
Identifier: loadtest
Version: ???
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: loadtest [582]
User ID: 501
Date/Time: 2021-07-15 12:56:09.913 +0300
OS Version: macOS 11.4 (20F71)
Report Version: 12
Bridge OS Version: 5.4 (18P4663)
Anonymous UUID: FD00A5BA-5166-EC7D-B051-E28BDEE29E95
Time Awake Since Boot: 110 seconds
System Integrity Protection: enabled
Crashed Thread: Unknown
Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace CODESIGNING, Code 0x1
kernel messages:
VM Regions Near 0 (cr2):
-->
mapped file 104a09000-104a0d000 [ 16K] r-x/r-x SM=COW Object_id=a7cdfe2f
Backtrace not available
Unknown thread crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x00007ffeeb1f6a88
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x000000010ee38000 rfl: 0x0000000000000200 cr2: 0x0000000000000000
Logical CPU: 0
Error Code: 0x00000000
Trap Number: 0
Unknown thread instruction stream not available.
Unknown thread last branch register state not available.
Binary images description not available
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
Writable regions: Total=8400K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=8400K(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
STACK GUARD 56.0M 1
Stack 8192K 1
VM_ALLOCATE 8K 2
VM_ALLOCATE (reserved) 232K 3 reserved VM address space (unallocated)
mapped file 968K 7
=========== ======= =======
TOTAL 65.2M 14
TOTAL, minus reserved VM space 65.0M 14
Model: MacBookPro16,1, BootROM 1554.120.19.0.0 (iBridge: 18.16.14663.0.0,0), 6 processors, 6-Core Intel Core i7, 2.6 GHz, 16 GB, SMC
Graphics: kHW_IntelUHDGraphics630Item, Intel UHD Graphics 630, spdisplays_builtin
Graphics: kHW_AMDRadeonPro5300MItem, AMD Radeon Pro 5300M, spdisplays_pcie_device, 4 GB
Memory Module: BANK 0/ChannelA-DIMM0, 8 GB, DDR4, 2667 MHz, Micron, 8ATF1G64HZ-2G6E1
Memory Module: BANK 2/ChannelB-DIMM0, 8 GB, DDR4, 2667 MHz, Micron, 8ATF1G64HZ-2G6E1
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x7BF), wl0: Feb 16 2021 03:05:58 version 9.30.444.10.32.5.67 FWID 01-3d719d60
Bluetooth: Version 8.0.5d7, 3 services, 25 devices, 1 incoming serial ports
Network Service: USB 10/100/1000 LAN, Ethernet, en7
USB Device: USB3.0 Hub
USB Device: USB 10/100/1000 LAN
USB Device: USB 3.1 Bus
USB Device: USB2.0 Hub
USB Device: Microsoft® Nano Transceiver v1.0
USB Device: USB 2.0 BILLBOARD
USB Device: Apple T2 Bus
USB Device: Composite Device
USB Device: Touch Bar Backlight
USB Device: Touch Bar Display
USB Device: Apple Internal Keyboard / Trackpad
USB Device: Headset
USB Device: Ambient Light Sensor
USB Device: FaceTime HD Camera (Built-in)
USB Device: Apple T2 Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 63.5
Thunderbolt Bus: MacBook Pro, Apple Inc., 63.5
...