Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

com.apple.pcsc Crashes in SCardDisconnect / transact / libdispatch / fork resource handling code #138

Open
macosforgebot opened this issue Dec 2, 2014 · 3 comments

Comments

@macosforgebot
Copy link

@macosforgebot macosforgebot commented Dec 2, 2014

berne.campbell@… originally submitted this as ticket:141

  • Cc: berne.campbell@…, adrien.pujol@…

I am using OpenVPN with PKCS#11 and getting a SEGV crash in in the child process after forking. It appears to be in the fork resource handling code. I have found a workaround by disabling threading and slotevent features in the pkcs11-helper library.

I previously opened a bug against OpenSC, OpenSC/OpenSC#333, who stated problem in pcsc-lite side where it is very old and has issues with fork resource management.

If I understand correctly Apple is using code derived from version 1.4.0 of pkcs-lite released in 2007, and that Apple's code changes has diverged much further in Yosemite from the upstream code base making merging them more work and less likely to happen. This saddens me.

This is the crash report: -

Process:               openvpn [452]
Path:                  /Library/Application Support/Viscosity/openvpn
Identifier:            openvpn
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        openvpn [450]
Responsible:           com.sparklabs.ViscosityHelper [351]
User ID:               0

Date/Time:             2014-11-25 20:56:56.035 +1100
OS Version:            Mac OS X 10.10 (14A389)
Report Version:        11
Anonymous UUID:        751DF87C-009E-4000-580A-ACC7D1C6A0EF

Sleep/Wake UUID:       353F94E5-9F6E-472A-A4AE-EDB2FC56D7CD

Time Awake Since Boot: 5200 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000110

VM Regions Near 0x110:
--> 
    __TEXT                 000000010fd2e000-000000010ff34000 [ 2072K] r-x/rwx SM=COW  /Library/Application Support/Viscosity/*

Application Specific Information:
crashed on child side of fork pre-exec

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libdispatch.dylib                0x00007fff930055d2 _dispatch_queue_wakeup_with_qos_slow + 525
1   libdispatch.dylib                0x00007fff930055f8 _dispatch_queue_wakeup_with_qos_slow + 563
2   libdispatch.dylib                0x00007fff92ffacfc _dispatch_mach_msg_send + 1690
3   libdispatch.dylib                0x00007fff92ffa5e4 dispatch_mach_send + 326
4   libxpc.dylib                     0x00007fff919a38b1 _xpc_connection_send_message_with_reply_f + 125
5   libxpc.dylib                     0x00007fff919a37c2 xpc_connection_send_message_with_reply_sync + 185
6   com.apple.pcsc                   0x0000000110038c5b transact + 604
7   com.apple.pcsc                   0x00000001100396b7 SCardDisconnect + 84
8   libopensc.3.dylib                0x000000011065043b pcsc_disconnect + 107
9   libopensc.3.dylib                0x0000000110611632 sc_disconnect_card + 274
10  opensc-pkcs11.so                 0x000000011000a7c6 card_removed + 278
11  opensc-pkcs11.so                 0x0000000110002d0a C_Finalize + 234
12  opensc-pkcs11.so                 0x0000000110002965 C_Initialize + 53
13  openvpn                          0x000000010fe9d731 __pkcs11h_forkFixup + 183
14  openvpn                          0x000000010fe9d667 __pkcs11h_threading_atfork_child + 61
15  libsystem_pthread.dylib          0x00007fff8f4dd0bf _pthread_fork_child_postinit + 69
16  libsystem_c.dylib                0x00007fff9275a0c8 fork + 29
17  openvpn                          0x000000010fd47bed openvpn_execve + 109
18  openvpn                          0x000000010fd47b02 openvpn_execve_check + 33
19  openvpn                          0x000000010fd84310 do_ifconfig + 340
20  openvpn                          0x000000010fd3ccbe do_open_tun + 1043
21  openvpn                          0x000000010fd3c36d do_up + 87
22  openvpn                          0x000000010fd6e43a incoming_push_message + 138
23  openvpn                          0x000000010fd36de2 check_incoming_control_channel_dowork + 295
24  openvpn                          0x000000010fd39402 pre_select + 1253
25  openvpn                          0x000000010fd54b9a main + 336
26  openvpn                          0x000000010fd2f634 start + 52

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007f9478d017d0  rcx: 0x0000000000000100  rdx: 0x0000000000000000
  rdi: 0x00007f9478c30030  rsi: 0x0000000000000001  rbp: 0x00007fff4fed0600  rsp: 0x00007fff4fed05d0
   r8: 0x0000000000000006   r9: 0x00000000fffffff0  r10: 0x0000000000000004  r11: 0x00007f9478d00000
  r12: 0x0000000000000000  r13: 0x00007f9478c30030  r14: 0x0000000000000800  r15: 0x00007fff7ca33bc0
  rip: 0x00007fff930055d2  rfl: 0x0000000000010206  cr2: 0x0000000000000110

Logical CPU:     0
Error Code:      0x00000006
Trap Number:     14


Binary Images:
       0x10fd2e000 -        0x10ff33fff +openvpn (???) <DD4AF181-DB48-344A-991E-9BC5CBC060A7> /Library/Application Support/Viscosity/openvpn
       0x110002000 -        0x11002cfff +opensc-pkcs11.so (0) <CB1CEDBA-E75B-36D9-A86E-400051FAE0BF> /Library/OpenSC/*/opensc-pkcs11.so
       0x110038000 -        0x110041ff7  com.apple.pcsc (8.0 - 1) <D2049B5D-7C84-30F4-9116-24D9847FDA5C> /System/Library/Frameworks/PCSC.framework/PCSC
       0x110600000 -        0x1107fdfff +libopensc.3.dylib (0) <46468334-C135-3D0F-8A26-16E884D28B2B> /Library/OpenSC/*/libopensc.3.dylib
    0x7fff618a7000 -     0x7fff618dd837  dyld (353.2.1) <4696A982-1500-34EC-9777-1EF7A03E2659> /usr/lib/dyld
    0x7fff8bf21000 -     0x7fff8bf59ffb  libsystem_network.dylib (411) <C0B2313D-47BE-38A9-BEE6-2634A4F5E14B> /usr/lib/system/libsystem_network.dylib
    0x7fff8c4c6000 -     0x7fff8c51afff  libc++.1.dylib (120) <1B9530FD-989B-3174-BB1C-BDC159501710> /usr/lib/libc++.1.dylib
    0x7fff8cf19000 -     0x7fff8cf1eff7  libunwind.dylib (35.3) <BE7E51A0-B6EA-3A54-9CCA-9D88F683A6D6> /usr/lib/system/libunwind.dylib
    0x7fff8cff8000 -     0x7fff8cff9ff7  libsystem_blocks.dylib (65) <9615D10A-FCA7-3BE4-AA1A-1B195DACE1A1> /usr/lib/system/libsystem_blocks.dylib
    0x7fff8d011000 -     0x7fff8d03cfff  libc++abi.dylib (125) <88A22A0F-87C6-3002-BFBA-AC0F2808B8B9> /usr/lib/libc++abi.dylib
    0x7fff8d2c9000 -     0x7fff8d2e5ff7  libsystem_malloc.dylib (53.1.1) <19BCC257-5717-3502-A71F-95D65AFA861B> /usr/lib/system/libsystem_malloc.dylib
    0x7fff8e0be000 -     0x7fff8e0c5ff7  libcompiler_rt.dylib (35) <BF8FC133-EE10-3DA6-9B90-92039E28678F> /usr/lib/system/libcompiler_rt.dylib
    0x7fff8f22a000 -     0x7fff8f232ffb  libcopyfile.dylib (118.1.2) <0C68D3A6-ACDD-3EF3-991A-CC82C32AB836> /usr/lib/system/libcopyfile.dylib
    0x7fff8f4d6000 -     0x7fff8f4dffff  libsystem_pthread.dylib (105.1.4) <26B1897F-0CD3-30F3-B55A-37CB45062D73> /usr/lib/system/libsystem_pthread.dylib
    0x7fff8f5b5000 -     0x7fff8f94bfff  com.apple.CoreFoundation (6.9 - 1151.16) <F2B088AF-A5C6-3FAE-9EB4-7931AF6359E4> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff904ff000 -     0x7fff90575fe7  libcorecrypto.dylib (233.1.2) <E1789801-3985-3949-B736-6B3378873301> /usr/lib/system/libcorecrypto.dylib
    0x7fff907b1000 -     0x7fff907b3ff7  libsystem_coreservices.dylib (9) <41B7C578-5A53-31C8-A96F-C73E030B0938> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff907b4000 -     0x7fff907e4fff  libsystem_m.dylib (3086.1) <1E12AB45-6D96-36D0-A226-F24D9FB0D9D6> /usr/lib/system/libsystem_m.dylib
    0x7fff907e5000 -     0x7fff907e5ff7  libunc.dylib (29) <5676F7EA-C1DF-329F-B006-D2C3022B7D70> /usr/lib/system/libunc.dylib
    0x7fff90925000 -     0x7fff90942ffb  libresolv.9.dylib (57) <26B38E61-298A-3C3A-82C1-3B5E98AD5E29> /usr/lib/libresolv.9.dylib
    0x7fff9156f000 -     0x7fff9156fff7  libkeymgr.dylib (28) <77845842-DE70-3CC5-BD01-C3D14227CED5> /usr/lib/system/libkeymgr.dylib
    0x7fff91607000 -     0x7fff91608ffb  libremovefile.dylib (35) <3485B5F4-6CE8-3C62-8DFD-8736ED6E8531> /usr/lib/system/libremovefile.dylib
    0x7fff9199a000 -     0x7fff919c2fff  libxpc.dylib (559.1.22) <9437C02E-A07B-38C8-91CB-299FAA63083D> /usr/lib/system/libxpc.dylib
    0x7fff9274a000 -     0x7fff927d6fff  libsystem_c.dylib (1044.1.2) <C185E862-7424-3210-B528-6B822577A4B8> /usr/lib/system/libsystem_c.dylib
    0x7fff92916000 -     0x7fff92927ff7  libz.1.dylib (55) <88C7C7DE-04B8-316F-8B74-ACD9F3DE1AA1> /usr/lib/libz.1.dylib
    0x7fff92ff3000 -     0x7fff9301dff7  libdispatch.dylib (442.1.4) <502CF32B-669B-3709-8862-08188225E4F0> /usr/lib/system/libdispatch.dylib
    0x7fff93026000 -     0x7fff9302efff  libsystem_platform.dylib (63) <64E34079-D712-3D66-9CE2-418624A5C040> /usr/lib/system/libsystem_platform.dylib
    0x7fff93e5d000 -     0x7fff93e5efff  libDiagnosticMessagesClient.dylib (100) <2EE8E436-5CDC-34C5-9959-5BA218D507FB> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff95a99000 -     0x7fff95aa1fff  libsystem_dnssd.dylib (561.1.1) <62B70ECA-E40D-3C63-896E-7F00EC386DDB> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff95f64000 -     0x7fff95f64ff7  liblaunch.dylib (559.1.22) <8A988924-8BE7-35FE-BF7D-322E90EFE49E> /usr/lib/system/liblaunch.dylib
    0x7fff95f65000 -     0x7fff95f6bfff  libsystem_trace.dylib (72.1.3) <A9E6B7D8-C327-3742-AC54-86C94218B1DF> /usr/lib/system/libsystem_trace.dylib
    0x7fff973d3000 -     0x7fff973d4fff  libsystem_secinit.dylib (18) <581DAD0F-6B63-3A48-B63B-917AF799ABAA> /usr/lib/system/libsystem_secinit.dylib
    0x7fff97568000 -     0x7fff97590fff  libsystem_info.dylib (459) <B85A85D5-8530-3A93-B0C3-4DEC41F79478> /usr/lib/system/libsystem_info.dylib
    0x7fff97591000 -     0x7fff97593ff7  libquarantine.dylib (76) <DC041627-2D92-361C-BABF-A869A5C72293> /usr/lib/system/libquarantine.dylib
    0x7fff97594000 -     0x7fff97677fff  libcrypto.0.9.8.dylib (52) <7208EEE2-C090-383E-AADD-7E1BD1321BEC> /usr/lib/libcrypto.0.9.8.dylib
    0x7fff97678000 -     0x7fff9767cfff  libcache.dylib (69) <45E9A2E7-99C4-36B2-BEE3-0C4E11614AD1> /usr/lib/system/libcache.dylib
    0x7fff97727000 -     0x7fff9773dff7  libsystem_asl.dylib (267) <F153AC5B-0542-356E-88C8-20A62CA704E2> /usr/lib/system/libsystem_asl.dylib
    0x7fff9775e000 -     0x7fff97764ff7  libsystem_networkextension.dylib (167.1.10) <29AB225B-D7FB-30ED-9600-65D44B9A9442> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff97881000 -     0x7fff9788aff7  libsystem_notify.dylib (133.1.1) <61147800-F320-3DAA-850C-BADF33855F29> /usr/lib/system/libsystem_notify.dylib
    0x7fff97a4b000 -     0x7fff97a4dff7  libsystem_sandbox.dylib (358.1.1) <DB9962EF-8898-31CC-9B87-E01F8CE74C9D> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff97a96000 -     0x7fff97adcff7  libauto.dylib (186) <A260789B-D4D8-316A-9490-254767B8A5F1> /usr/lib/libauto.dylib
    0x7fff97c7f000 -     0x7fff97c81fff  libsystem_configuration.dylib (699.1.5) <9FBA1CE4-97D0-347E-A443-93ED94512E92> /usr/lib/system/libsystem_configuration.dylib
    0x7fff97cee000 -     0x7fff97ed3ff3  libicucore.A.dylib (531.30) <EF0E7544-E317-3550-A962-6AE65E78AF17> /usr/lib/libicucore.A.dylib
    0x7fff98775000 -     0x7fff9877aff7  libmacho.dylib (862) <126CA2ED-DE91-308F-8881-B9DAEC3C63B6> /usr/lib/system/libmacho.dylib
    0x7fff9877c000 -     0x7fff9877dfff  com.apple.TrustEvaluationAgent (2.0 - 25) <2D61A2C3-C83E-3A3F-8EC1-736DBEC250AB> /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/TrustEvaluationAgent
    0x7fff98a81000 -     0x7fff98a84ff7  libdyld.dylib (353.2.1) <19FAF435-C165-3374-9DEF-D7BBA7D61DB6> /usr/lib/system/libdyld.dylib
    0x7fff98c93000 -     0x7fff98c94fff  libSystem.B.dylib (1213) <DA954461-EC6A-3DF0-8551-6FC810627627> /usr/lib/libSystem.B.dylib
    0x7fff98f7e000 -     0x7fff98f8fff7  libsystem_coretls.dylib (35.1.2) <EBBF7EF6-80D8-3F8F-825C-B412BD6D22C0> /usr/lib/system/libsystem_coretls.dylib
    0x7fff99b81000 -     0x7fff99b9efff  libsystem_kernel.dylib (2782.1.97) <93E0E0A9-75B6-3904-BB4E-4BC7C05F4B6B> /usr/lib/system/libsystem_kernel.dylib
    0x7fff99f3d000 -     0x7fff99f48fff  libcommonCrypto.dylib (60061) <D381EBC6-69D8-31D3-8084-5A80A32CB748> /usr/lib/system/libcommonCrypto.dylib
    0x7fff9a78b000 -     0x7fff9a78ffff  libsystem_stats.dylib (163.1.4) <1DB04436-5974-3F16-86CC-5FF5F390339C> /usr/lib/system/libsystem_stats.dylib
    0x7fff9a8ad000 -     0x7fff9aa92267  libobjc.A.dylib (646) <3B60CD90-74A2-3A5D-9686-B0772159792A> /usr/lib/libobjc.A.dylib

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: 1279
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=87.1M resident=26.1M(30%) swapped_out_or_unallocated=61.0M(70%)
Writable regions: Total=32.1M written=268K(1%) resident=2772K(8%) swapped_out=0K(0%) unallocated=29.4M(92%)

REGION TYPE                      VIRTUAL
===========                      =======
Dispatch continuations             4096K
Kernel Alloc Once                     4K
MALLOC                             18.2M
MALLOC (admin)                       16K
MALLOC_LARGE (reserved)             256K        reserved VM address space (unallocated)
STACK GUARD                        56.0M
Stack                              9316K
VM_ALLOCATE                          28K
__DATA                             1644K
__LINKEDIT                         70.6M
__TEXT                             16.5M
__UNICODE                           544K
shared memory                         4K
===========                      =======
TOTAL                             176.9M
TOTAL, minus reserved VM space    176.6M
@macosforgebot

This comment has been minimized.

Copy link
Author

@macosforgebot macosforgebot commented Dec 2, 2014

berne.campbell@… originally submitted this as comment:1:⁠ticket:141

  • Cc berne.campbell@… added
@macosforgebot

This comment has been minimized.

Copy link
Author

@macosforgebot macosforgebot commented Dec 2, 2014

adrien.pujol@… originally submitted this as comment:2:⁠ticket:141

  • Cc adrien.pujol@… added
@macosforgebot

This comment has been minimized.

Copy link
Author

@macosforgebot macosforgebot commented May 5, 2016

@ryandesign originally submitted this as comment:3:⁠ticket:141

  • Description modified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.