evgenyneu / keychain-swift

Helper functions for saving text in Keychain securely for iOS, OS X, tvOS and watchOS.
MIT License
2.84k stars 345 forks source link

Crash KeychainSwift.getData(_:asReference:) + 48 (KeychainSwift.swift:193) #184

Open barendu opened 8 months ago

barendu commented 8 months ago

thread 20 的堆栈和这个lib有关

Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x0000000218c241e4 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [92719]

Triggered by Thread: 0

Thread 0 name: Thread 0 Crashed: 0 libsystem_platform.dylib 0x0000000218c241e4 _os_unfair_lock_recursive_abort + 36 (lock.c:508) 1 libsystem_platform.dylib 0x0000000218c1f01c _os_unfair_lock_lock_slow + 284 (lock.c:567) 2 libobjc.A.dylib 0x00000001b1f10470 lookUpImpOrForward + 156 (objc-runtime-new.mm:6899) 3 libobjc.A.dylib 0x00000001b1f0acc4 _objc_msgSend_uncached + 68 (:-1) 4 aosu 0x00000001021552dc getFreeStorageSize + 72 (KSCrashMonitor_System.m:483) 5 aosu 0x00000001021552dc addContextualInfoToEvent + 540 (KSCrashMonitor_System.m:625) 6 aosu 0x000000010212ad08 addContextualInfoToEvent + 24 (KSCrashMonitor.c:169) 7 aosu 0x000000010212ad08 wpk_kscm_handleException + 120 (KSCrashMonitor.c:295) 8 aosu 0x0000000102126600 handleSignal + 432 (KSCrashMonitor_Signal.c:138) 9 libsystem_platform.dylib 0x0000000218c20214 _sigtramp + 56 (sigtramp.c:116) 10 libobjc.A.dylib 0x00000001b1f12ef8 getMethodNoSuper_nolock(objc_class, objc_selector) + 80 (objc-runtime-new.mm:6550) 11 libobjc.A.dylib 0x00000001b1f1058c lookUpImpOrForward + 440 (objc-runtime-new.mm:6930) 12 libobjc.A.dylib 0x00000001b1f0acc4 _objc_msgSend_uncached + 68 (:-1) 13 UIKitCore 0x00000001bb28a9a0 -[UIKeyboardSceneDelegate keyboardSceneDelegateWillResume:] + 108 (UIKeyboardSceneDelegate.m:232) 14 CoreFoundation 0x00000001b8eb2590 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 148 (CFNotificationCenter.c:661) 15 CoreFoundation 0x00000001b8f56828 _CFXRegistrationPost_block_invoke + 88 (CFNotificationCenter.c:175) 16 CoreFoundation 0x00000001b8f398b8 _CFXRegistrationPost + 440 (CFNotificationCenter.c:201) 17 CoreFoundation 0x00000001b8ec6afc _CFXNotificationPost + 700 (CFNotificationCenter.c:1193) 18 Foundation 0x00000001b3191d18 -[NSNotificationCenter postNotificationName:object:userInfo:] + 92 (NSNotification.m:518) 19 UIKitCore 0x00000001bb08ab30 -[UIApplication _sendWillEnterForegroundCallbacks] + 224 (UIApplication.m:11741) 20 UIKitCore 0x00000001bb08a66c 101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 1272 (_UISceneLifecycleMultiplexer.m:654) 21 UIKitCore 0x00000001baf85664 _UIScenePerformActionsWithLifecycleActionMask + 112 (_UISceneLifecycleState.m:109) 22 UIKitCore 0x00000001bb2c3850 101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216 (_UISceneLifecycleMultiplexer.m:567) 23 UIKitCore 0x00000001bb175c5c -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 220 (_UISceneLifecycleMultiplexer.m:516) 24 UIKitCore 0x00000001bb175a84 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 620 (_UISceneLifecycleMultiplexer.m:566) 25 UIKitCore 0x00000001bb175634 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 252 (_UISceneLifecycleMultiplexer.m:469) 26 UIKitCore 0x00000001bb175500 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... + 148 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:73) 27 UIKitCore 0x00000001bb862a68 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736 (BSAnimationSettings+UIKit.m:54) 28 UIKitCore 0x00000001bb901074 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224 (_UISceneSettingsDiffAction.m:27) 29 UIKitCore 0x00000001bb022c70 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:58) 30 UIKitCore 0x00000001bb4941ac 64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.223 + 556 (UIScene.m:2007) 31 UIKitCore 0x00000001bb0f3c60 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 216 (UIScene.m:1683) 32 UIKitCore 0x00000001bb0f3ad0 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244 (UIScene.m:1969) 33 UIKitCore 0x00000001bb0f3910 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 336 (UIApplicationSceneClientAgent.m:86) 34 FrontBoardServices 0x00000001cef00ac8 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 420 (FBSScene.m:549) 35 FrontBoardServices 0x00000001cef00904 94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 152 (FBSWorkspaceScenesClient.m:606) 36 FrontBoardServices 0x00000001cef04120 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168 (FBSWorkspace.m:359) 37 FrontBoardServices 0x00000001cef0403c __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 344 (FBSWorkspaceScenesClient.m:605) 38 libdispatch.dylib 0x00000001c034beac _dispatch_client_callout + 20 (object.m:560) 39 libdispatch.dylib 0x00000001c034f91c _dispatch_block_invoke_direct + 264 (queue.c:496) 40 FrontBoardServices 0x00000001cef0e24c FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52 (FBSSerialQueue.m:157) 41 FrontBoardServices 0x00000001cef0dde8 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220 (FBSSerialQueue.m:181) 42 FrontBoardServices 0x00000001cef10694 -[FBSSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:194) 43 CoreFoundation 0x00000001b8f4e128 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 (CFRunLoop.c:1957) 44 CoreFoundation 0x00000001b8f5a7b4 CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001) 45 CoreFoundation 0x00000001b8edf648 CFRunLoopDoSources0 + 340 (CFRunLoop.c:2046) 46 CoreFoundation 0x00000001b8ef50d4 __CFRunLoopRun + 828 (CFRunLoop.c:2953) 47 CoreFoundation 0x00000001b8efa3ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 48 GraphicsServices 0x00000001f441035c GSEventRunModal + 164 (GSEvent.c:2196) 49 UIKitCore 0x00000001bb286f58 -[UIApplication _run] + 888 (UIApplication.m:3782) 50 UIKitCore 0x00000001bb286bbc UIApplicationMain + 340 (UIApplication.m:5372) 51 aosu 0x0000000100163500 main + 100 (main.m:20) 52 dyld 0x00000001d842cdec start + 2220 (dyldMain.cpp:1165)

Thread 20 name: Thread 20: 0 libsystem_kernel.dylib 0x00000001f7e3aca4 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001f7e4db74 mach_msg2_internal + 80 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001f7e4de4c mach_msg_overwrite + 540 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001f7e3b1e8 mach_msg + 24 (mach_msg.c:323) 4 libdispatch.dylib 0x00000001c036720c _dispatch_mach_send_and_wait_for_reply + 548 (mach.c:1980) 5 libdispatch.dylib 0x00000001c036759c dispatch_mach_send_with_result_and_wait_for_reply + 60 (mach.c:2017) 6 libxpc.dylib 0x0000000218d08218 xpc_connection_send_message_with_reply_sync + 240 (connection.c:3943) 7 Security 0x00000001c0b71a0c securityd_message_with_reply_sync + 124 (client.c:701) 8 Security 0x00000001c0b7ba0c securityd_send_sync_and_do + 88 (client.c:800) 9 Security 0x00000001c0c2f3b8 cftype_to_bool_cftype_error_request + 160 (SecItem.m:1645) 10 Security 0x00000001c0b6c038 __SecItemCopyMatching_block_invoke_2 + 200 (SecItem.m:1983) 11 Security 0x00000001c0b6efd0 SecItemAuthDoQuery_block_invoke + 532 (SecItem.m:1619) 12 Security 0x00000001c0b6dc00 SecItemAuthDoQuery + 1316 (SecItem.m:1585) 13 Security 0x00000001c0b6eca0 SecItemCopyMatching_blockinvoke + 140 (SecItem.m:1980) 14 Security 0x00000001c0b748f8 SecOSStatusWith + 56 (SecItem.m:331) 15 Security 0x00000001c0b6eb68 SecItemCopyMatching + 400 (SecItem.m:1979) 16 aosu 0x0000000100d58788 closure #1 in KeychainSwift.getData(:asReference:) + 48 (KeychainSwift.swift:193) 17 aosu 0x0000000100d58788 specialized withUnsafeMutablePointer<A, B>(to::) + 48 (:0) 18 aosu 0x0000000100d58788 KeychainSwift.getData(:asReference:) + 820 (KeychainSwift.swift:192) 19 aosu 0x0000000100d583cc KeychainSwift.get(_:) + 88 (KeychainSwift.swift:145) 20 aosu 0x0000000100792f88 AosuPreferences.getStringInPreferenceAndKeyChain(key:) + 32 (AosuPreferences.swift:478) 21 aosu 0x0000000100792f88 specialized UIDevice.deviceId.getter + 212 (SwiftLangExt.swift:324) 22 aosu 0x0000000100853154 UIDevice.deviceId.getter + 4 (:0) 23 aosu 0x0000000100853154 specialized static CommonInterceptor.buildCommonHeaders() + 1376

barendu commented 8 months ago

帮着分析一下

MagdyZamel commented 2 months ago

Hey @barendu,

Did you find any solution?