[NEHotspotConfigurationManager getConfiguredSSIDsWithCompletionHandler:] crashes sometimes

I am trying to reproduce the crash reported by our CI.

The app uses [NEHotspotConfigurationManager getConfiguredSSIDsWithCompletionHandler:] API to manage SSID configurations and it works fine on device and does not cause any issues when I try to reproduce it in Sim locally.

However, the crash report says that the crash does occur from time to time.

Below is the snipped of the crash report:

Code Block
...
Code Type: X86-64 (Native)
Parent Process: launchd_sim [52571]
Responsible: SimulatorTrampoline [52274]
OS Version: Mac OS X 10.15.5 (19F101)
System Integrity Protection: disabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [52945]
Application Specific Information:
CoreSimulator 704.12.2 - Device: iPhone 8 (5758E665-FD34-4B76-8846-B8C3551B3E14) - Runtime: iOS 13.6 (17G64) - DeviceType: iPhone 8
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libxpc.dylib 0x00000001182e8156 xpc_get_type + 72
1 libxpc.dylib 0x00000001182edf01 xpc_connection_send_message + 21
2 com.apple.NetworkExtension 0x00000001131af9d1 -[NEHelper connection] + 313
3 com.apple.NetworkExtension 0x00000001131afcf6 -[NEHelper sendRequest:responseHandler:] + 76
4 com.apple.NetworkExtension 0x00000001131b2674 -[NEHotspotConfigurationHelper sendRequest:requestType:resultHandler:] + 242
5 com.apple.NetworkExtension 0x00000001131b9c0c -[NEHotspotConfigurationManager getConfiguredSSIDsWithCompletionHandler:] + 163
...


I'm thinking maybe it is an Entitlement issue, since the API usage requires special entitlement. Does XPC call stack suggest this?

In general, this API does not make much sense for the Sim, so I'm thinking about mocking it for that particular case under the conditions
Code Block
#if targetEnvironment(simulator)
#else
#endif


But, I still want to figure out the cause.

Replies

I'm thinking maybe it is an Entitlement issue, since the API usage requires special entitlement. Does XPC call stack suggest this?

I do not think this is a entitlement issue because com.apple.developer.networking.HotspotConfiguration is not a special entitlement. This is one that you can add to your app as a normal capability.

Does this happen more if there are no network configuration on the simulator compared to 1 or more? The reason I ask is that this looks like a simulator issue and NEHotspotConfigurationManager is not an API that is available on macOS, so I am wondering if you are just hitting an edge case there.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com