Repository navigation
fix: Guard CoreTelephony radio technology read - #9332
Merged
Merged
Conversation
CTTelephonyNetworkInfo returns its internal NSMutableDictionary from serviceCurrentRadioAccessTechnology and changes it on a private queue inside @synchronized on that dictionary. Bridging the result to a Swift dictionary walked it without the lock, so a concurrent change released values during the walk and crashed with EXC_BAD_ACCESS. Read the getter without bridging and copy the dictionary under the same lock. Move the provider behind the experimental option enableConnectionEffectiveType, which installs an integration that registers the provider with SentryReachability. Fixes #9312 Fixes #9330
With the read guarded by the CoreTelephony lock, the provider stays enabled by default, so the experimental option, its integration and the SentryReachability changes are not needed. Restore them to main.
alwx
marked this pull request as ready for review
October 13, 2026 07:53
alwx
requested review from
NinjaLikesCheez,
itaybre,
noahsmartin and
philprime
as code owners
October 13, 2026 07:53
7 of 9 tasks
philprime
reviewed
Oct 13, 2026
Add a test that fails when CTTelephonyNetworkInfo stops locking on the dictionary it returns, or stops returning its internal dictionary. Move the objc_sync helper from SentryPerformanceTracker to Locks.swift and use it for the copy.
philprime
approved these changes
Oct 13, 2026
philprime
left a comment
Member
There was a problem hiding this comment.
I am not 100% happy with using the selector based access of a property, but as it is a public one LGTM.
If possible please verify that it also works properly with a real test device as I could imaging CoreTelephony being a partially mock framework in the simulator
Size Analysis1 component analyzed iOS Builds
|
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c8c3374 | 1232.96 ms | 1263.46 ms | 30.50 ms |
| d9571ee | 1225.67 ms | 1259.02 ms | 33.35 ms |
| 88e0b6e | 1212.93 ms | 1251.27 ms | 38.33 ms |
| 02b997a | 1224.77 ms | 1263.96 ms | 39.19 ms |
| 732f9d0 | 1226.15 ms | 1270.74 ms | 44.60 ms |
| b0aa013 | 1208.48 ms | 1244.00 ms | 35.52 ms |
| 545ca7e | 1233.89 ms | 1269.30 ms | 35.41 ms |
| 065705e | 1217.35 ms | 1253.04 ms | 35.69 ms |
| f6e658b | 1203.39 ms | 1238.34 ms | 34.95 ms |
| 89ccfc2 | 1210.78 ms | 1245.02 ms | 34.24 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c8c3374 | 24.14 KiB | 1.38 MiB | 1.36 MiB |
| d9571ee | 24.14 KiB | 1.39 MiB | 1.36 MiB |
| 88e0b6e | 24.14 KiB | 1.38 MiB | 1.36 MiB |
| 02b997a | 24.14 KiB | 1.39 MiB | 1.36 MiB |
| 732f9d0 | 24.14 KiB | 1.38 MiB | 1.36 MiB |
| b0aa013 | 24.14 KiB | 1.38 MiB | 1.36 MiB |
| 545ca7e | 24.14 KiB | 1.39 MiB | 1.36 MiB |
| 065705e | 24.14 KiB | 1.38 MiB | 1.35 MiB |
| f6e658b | 24.14 KiB | 1.38 MiB | 1.35 MiB |
| 89ccfc2 | 24.14 KiB | 1.38 MiB | 1.36 MiB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
The SDK no longer bridges
serviceCurrentRadioAccessTechnologyto a Swift dictionary. It reads the rawNSDictionaryand copies it under the same@synchronizedlock that CoreTelephony uses when it changes the dictionary.connection_effective_typestays enabled by default.💡 Motivation and Context
Fixes #9312 and #9330.
CTTelephonyNetworkInforeturns its internalNSMutableDictionarywithout a copy and changes it on a private queue. Thus, the Swift bridge read values that CoreTelephony released at the same time. The disassembly of CoreTelephony in the iOS 18.6 and iOS 26.1 simulator runtimes shows this behavior. This PR replaces #9318, which removes the feature.💚 How did you test it?
The provider, reachability, extra context, and SDK unit tests pass on iOS 18.6. A new test holds the lock in place of CoreTelephony and makes sure that the copy waits for the change. Without the lock, this test failed in two of three runs. The crash cannot occur in tests, because the simulator has no cellular data. The fix still needs a test on a device with a SIM card.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.