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

Inserting CAC causes Firefox to completely freeze #1278

Closed
andrewgdunn opened this issue Feb 27, 2018 · 31 comments
Closed

Inserting CAC causes Firefox to completely freeze #1278

andrewgdunn opened this issue Feb 27, 2018 · 31 comments
Labels

Comments

@andrewgdunn
Copy link

Problem Description

Using firefox nightly (60.0a1), or any version that is based off 60, seems to be impacted. If you have a running process of firefox and you insert a CAC and attempt to query it in any way (via a site that requests it, or via viewing your certificates) it will lock up the firefox process(s).

If you kill the processes and insert the CAC, then launch firefox, it seems to work nominally. Alternatively, if you put the CAC in prior to ever lunching firefox on a fresh install it works nominally.

If you have a timeout on your pin where firefox prompts you (in your main session or a private session), it entirely locks up the firefox process(s) until you enter your pin.

Proposed Resolution

reporting for awareness. I've talked to some other people who are seeing this and living with it without reporting. I realize that using nightly will come with edges that might cut, reporting this now so that it can get eyes before firefox ships stably with whatever is causing this issue.

Steps to reproduce

  • have ccid installed (ccid-git ccid.1.4.29.r0.g7ab9a8b-1) (running from the aur)
  • have pcsc-lite installed (pcsclite-git pcsc.1.8.23.r1.gcc70541-1) (running from the aur)
  • have opensc installed (opensc 0.17.0-1) (running from the community repository
  • have firefox-nightly installed
  • follow directions for firefox/cac from the wiki

The other steps are enumerated above in the problem description.

Logs

What logs (assuming more than opensc) would be advisable to grab?

@frankmorgner
Copy link
Member

Your description on Firefox seems very specific, did it work with some previous version? @Jakuje ?

@Jakuje
Copy link
Member

Jakuje commented Feb 27, 2018

Can you try with OpenSC master? There were several fixes since 0.17.0 release so your issue might be already fixed.

@djKianoosh
Copy link

I also tried it with 0.17.0 and master and both hang. I have Firefox Developer Edition 60.0b2, on a Mac.

@Jakuje
Copy link
Member

Jakuje commented Mar 14, 2018

So lets have a look into the logs to see where does it hang and why:

https://github.com/OpenSC/OpenSC/wiki/Using-OpenSC#debug-level

If it will not give anything useful, what does GDB says, when you attach it to the process that loaded the OpenSC PKCS#11 module.

@Jakuje
Copy link
Member

Jakuje commented Mar 15, 2018

I noticed this issue with different card, that does not have random number generator. It seems like something new in Firefox/NSS started requesting C_GenerateRandom() for some reason (and that is fancily not logged in pkcs11-layer of the library code at all -- will submit a PR).

Can you verify that the following code will hang for you (you will probably need to adjust some paths to pkcs11.h):
https://github.com/Jakuje/stuff/blob/master/randomtest.c

If I see right, CAC and Coolkey get_challenge routines do not expect it can fail, which needs to be fixed and if we are not able to get any data from the card, we should return appropriate error to PKCS#11 interface.

@mouse07410
Copy link
Contributor

mouse07410 commented Mar 16, 2018

Can you verify that the following code will hang for you...

I confirm that Firefox 60+ hangs when the token is inserted, and any request is made to it.

With the current master on MacOS 10.13.3, your code does not hang (nor does pkcs11-tool). It takes a few seconds, but then your code returns CKR_OK for C_Initialize() and C_OpenSession(),and then CKR_DATA_INVALID for C_GenerateRandom(). After a few of such runs, shell hung up - I was not able to spawn new shells for a while:

$ ./randomtest 
C_Initialize returned 0 OK...
C_OpenSession() returned 0 OK
C_GenerateRandom() returned 0x20 Not OK
reason: Data invalid

Here's the SPY:

$ OPENSC_DEBUG=9 pkcs11-tool --module /Library/OpenSC/lib/pkcs11-spy.dylib --generate-random 8


*************** OpenSC PKCS#11 spy *****************
Loaded: "/Library/OpenSC/lib/opensc-pkcs11.dylib"

0: C_GetFunctionList
2018-03-15 22:22:11.798
Returned:  0 CKR_OK

1: C_Initialize
2018-03-15 22:22:11.799
[in] pInitArgs = 0x0
0x7fffb197b340 22:22:11.799 [opensc-pkcs11] ctx.c:681:process_config_file: Using configuration file '/Library/OpenSC/etc/opensc.conf'
Returned:  0 CKR_OK
. . . . .
4: C_GetSlotInfo
2018-03-15 22:22:14.547
[in] slotID = 0x0
[out] pInfo: 
      slotDescription:        'Identiv SCR3500 C Contact Reader'
                              '                                '
      manufacturerID:         'Identiv                         '
      hardwareVersion:         0.0
      firmwareVersion:         0.0
      flags:                   7
        CKF_TOKEN_PRESENT                
        CKF_REMOVABLE_DEVICE             
        CKF_HW_SLOT                      
Returned:  0 CKR_OK
Using slot 0 with a present token (0x0)

5: C_OpenSession
2018-03-15 22:22:14.549
[in] slotID = 0x0
[in] flags = 0x4
pApplication=0x0
Notify=0x0
[out] *phSession = 0x7fdcfed07920
Returned:  0 CKR_OK

6: C_GenerateRandom
2018-03-15 22:22:14.549
[in] hSession = 0x7fdcfed07920
Returned:  32 CKR_DATA_INVALID
error: Could not generate random bytes
Aborting.

On YubiKey your code prints (I've added more verbose output):

$ ./randomtest 
C_Initialize returned 0 OK...
C_OpenSession() returned 0 OK
C_GenerateRandom() returned 0 OK
???????$??W??Y??m????>?{$

and SPY via pkcs11-tool:

$ OPENSC_DEBUG=9 pkcs11-tool --module /Library/OpenSC/lib/pkcs11-spy.dylib --generate-random 8

*************** OpenSC PKCS#11 spy *****************
Loaded: "/Library/OpenSC/lib/opensc-pkcs11.dylib"

0: C_GetFunctionList
2018-03-15 22:22:52.589
Returned:  0 CKR_OK

1: C_Initialize
2018-03-15 22:22:52.590
[in] pInitArgs = 0x0
0x7fffb197b340 22:22:52.590 [opensc-pkcs11] ctx.c:681:process_config_file: Using configuration file '/Library/OpenSC/etc/opensc.conf'
Returned:  0 CKR_OK
. . . . .
5: C_GetSlotInfo
2018-03-15 22:22:52.704
[in] slotID = 0x4
[out] pInfo: 
      slotDescription:        'Yubico Yubikey 4 OTP+U2F+CCID   '
                              '                                '
      manufacturerID:         '                                '
      hardwareVersion:         4.55
      firmwareVersion:         0.0
      flags:                   7
        CKF_TOKEN_PRESENT                
        CKF_REMOVABLE_DEVICE             
        CKF_HW_SLOT                      
Returned:  0 CKR_OK
Using slot 1 with a present token (0x4)

6: C_OpenSession
2018-03-15 22:22:52.707
[in] slotID = 0x4
[in] flags = 0x4
pApplication=0x0
Notify=0x0
[out] *phSession = 0x7f8c5940ef70
Returned:  0 CKR_OK

7: C_GenerateRandom
2018-03-15 22:22:52.707
[in] hSession = 0x7f8c5940ef70
[out] RandomData[ulRandomLen] 00007f8c5940eff0 / 8
    00000000  C7 3E F7 1A 3A 6E 6A 1D                          .>..:nj.        
Returned:  0 CKR_OK

8: C_CloseSession
2018-03-15 22:22:52.711
[in] hSession = 0x7f8c5940ef70
Returned:  0 CKR_OK

9: C_Finalize
2018-03-15 22:22:52.711
Returned:  0 CKR_OK

@Jakuje
Copy link
Member

Jakuje commented Mar 16, 2018

If this happens also for you with PIV and Firefox, debug log from opensc, where does it hang for you would be helpful (just the end to see where it hangs/cycles should be enough).

I still don't have Firefox 60 so I can not verify at the moment.

@dengert
Copy link
Member

dengert commented Mar 16, 2018 via email

@mouse07410
Copy link
Contributor

mouse07410 commented Mar 16, 2018

Firefox ESR 52.6.0 (64-bit) appears to work with CAC.

Firefox 60.0 (6018.3.12) hangs even on the attempt to go to Security Devices:

Date/Time:       2018-03-16 11:49:05 -0400
OS Version:      Mac OS X 10.12.6 (Build 16G1212)
Architecture:    x86_64h
Report Version:  25

Data Source:     Stackshots

Command:         firefox
Path:            /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox
Version:         60.0 (6018.3.12)
Parent:          launchd [1]
PID:             17404

Event:           hang
Duration:        0.97s (process was unresponsive for 256 seconds before sampling)
Steps:           10 (100ms sampling interval)

Hardware model:  MacBookPro11,5
Active cpus:     8

Fan speed:       6152 rpm

--------------------------------------------------
Timeline format: stacks are sorted chronologically
Use -i and -heavy to re-report with count sorting
--------------------------------------------------

Heaviest stack for the main thread of the target process:
  10  start + 52 (firefox + 3332) [0x10fe03d04]
  10  main + 551 (firefox + 3927) [0x10fe03f57]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54971992) [0x113938e58]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54970372) [0x113938804]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54967860) [0x113937e34]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54244196) [0x113887364]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36453382) [0x11278fc06]
  10  -[NSApplication run] + 926 (AppKit + 242651) [0x7fffa36343db]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36449478) [0x11278ecc6]
  10  -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796 (AppKit + 8136686) [0x7fffa3dbb7ee]
  10  _DPSNextEvent + 1120 (AppKit + 289364) [0x7fffa363fa54]
  10  _BlockUntilNextEventMatchingListInModeWithFilter + 71 (HIToolbox + 199462) [0x7fffa50a8b26]
  10  ReceiveNextEventCommon + 432 (HIToolbox + 199921) [0x7fffa50a8cf1]
  10  RunCurrentEventLoopInMode + 240 (HIToolbox + 200380) [0x7fffa50a8ebc]
  10  CFRunLoopRunSpecific + 420 (CoreFoundation + 553236) [0x7fffa5b48114]
  10  __CFRunLoopRun + 934 (CoreFoundation + 554774) [0x7fffa5b48716]
  10  __CFRunLoopDoSources0 + 557 (CoreFoundation + 557597) [0x7fffa5b4921d]
  10  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 (CoreFoundation + 684833) [0x7fffa5b68321]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36451911) [0x11278f647]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36089665) [0x112736f41]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 781331) [0x11058ac13]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 744631) [0x110581cb7]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 15769885) [0x1113d611d]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 15682768) [0x1113c0cd0]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 1323236) [0x11060f0e4]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9813245) [0x110e27cfd]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9812336) [0x110e27970]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9809714) [0x110e26f32]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9813590) [0x110e27e56]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9814736) [0x110e282d0]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 51705920) [0x11361b840]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 51697099) [0x1136195cb]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 51700995) [0x11361a503]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 39176803) [0x112a28a63]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27227884) [0x111ec36ec]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27223325) [0x111ec251d]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27251504) [0x111ec9330]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27250098) [0x111ec8db2]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27320762) [0x111eda1ba]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 22670458) [0x111a6ac7a]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 59669998) [0x113db3dee]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56178937) [0x113a5f8f9]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56178479) [0x113a5f72f]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56124045) [0x113a5228d]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56158383) [0x113a5a8af]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56178098) [0x113a5f5b2]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 8351961) [0x110cc30d9]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 8345806) [0x110cc18ce]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 805310) [0x1105909be]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 53185668) [0x113784c84]
  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 53134077) [0x1137782fd]
  10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1792902) [0x1102b5b86]
  10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1551358) [0x11027abfe]
  10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1405662) [0x1102572de]
  10  __psynch_mutexwait + 10 (libsystem_kernel.dylib + 105506) [0x7fffbb3fdc22]
 *10  psynch_mtxcontinue + 0 (pthread + 31211) [0xffffff7f8135f9eb]


Process:         firefox (Firefox Developer Edition) [17404]
Path:            /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox
Architecture:    x86_64
Parent:          launchd [1]
UID:             1638356520
Task size:       500.82 MB
CPU Time:        0.920
Note:            Unresponsive for 256 seconds before sampling
Note:            1 idle work queue threads omitted

  Thread 0x3418222          DispatchQueue 1           10 samples (1-10)         priority 47 (base 47)     cpu time <0.001
  <process frontmost, thread QoS user interactive (requested user interactive), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  start + 52 (firefox + 3332) [0x10fe03d04] 1-10
    10  main + 551 (firefox + 3927) [0x10fe03f57] 1-10
      10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54971992) [0x113938e58] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54970372) [0x113938804] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54967860) [0x113937e34] 1-10
            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54244196) [0x113887364] 1-10
              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36453382) [0x11278fc06] 1-10
                10  -[NSApplication run] + 926 (AppKit + 242651) [0x7fffa36343db] 1-10
                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36449478) [0x11278ecc6] 1-10
                    10  -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796 (AppKit + 8136686) [0x7fffa3dbb7ee] 1-10
                      10  _DPSNextEvent + 1120 (AppKit + 289364) [0x7fffa363fa54] 1-10
                        10  _BlockUntilNextEventMatchingListInModeWithFilter + 71 (HIToolbox + 199462) [0x7fffa50a8b26] 1-10
                          10  ReceiveNextEventCommon + 432 (HIToolbox + 199921) [0x7fffa50a8cf1] 1-10
                            10  RunCurrentEventLoopInMode + 240 (HIToolbox + 200380) [0x7fffa50a8ebc] 1-10
                              10  CFRunLoopRunSpecific + 420 (CoreFoundation + 553236) [0x7fffa5b48114] 1-10
                                10  __CFRunLoopRun + 934 (CoreFoundation + 554774) [0x7fffa5b48716] 1-10
                                  10  __CFRunLoopDoSources0 + 557 (CoreFoundation + 557597) [0x7fffa5b4921d] 1-10
                                    10  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 (CoreFoundation + 684833) [0x7fffa5b68321] 1-10
                                      10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36451911) [0x11278f647] 1-10
                                        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 36089665) [0x112736f41] 1-10
                                          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 781331) [0x11058ac13] 1-10
                                            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 744631) [0x110581cb7] 1-10
                                              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 15769885) [0x1113d611d] 1-10
                                                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 15682768) [0x1113c0cd0] 1-10
                                                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 1323236) [0x11060f0e4] 1-10
                                                    10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9813245) [0x110e27cfd] 1-10
                                                      10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9812336) [0x110e27970] 1-10
                                                        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9809714) [0x110e26f32] 1-10
                                                          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9813590) [0x110e27e56] 1-10
                                                            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 9814736) [0x110e282d0] 1-10
                                                              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 51705920) [0x11361b840] 1-10
                                                                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 51697099) [0x1136195cb] 1-10
                                                                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 51700995) [0x11361a503] 1-10
                                                                    10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 39176803) [0x112a28a63] 1-10
                                                                      10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27227884) [0x111ec36ec] 1-10
                                                                        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27223325) [0x111ec251d] 1-10
                                                                          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27251504) [0x111ec9330] 1-10
                                                                            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27250098) [0x111ec8db2] 1-10
                                                                              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 27320762) [0x111eda1ba] 1-10
                                                                                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 22670458) [0x111a6ac7a] 1-10
                                                                                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 59669998) [0x113db3dee] 1-10
                                                                                    10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56178937) [0x113a5f8f9] 1-10
                                                                                      10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56178479) [0x113a5f72f] 1-10
                                                                                        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56124045) [0x113a5228d] 1-10
                                                                                          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56158383) [0x113a5a8af] 1-10
                                                                                            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 56178098) [0x113a5f5b2] 1-10
                                                                                              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 8351961) [0x110cc30d9] 1-10
                                                                                                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 8345806) [0x110cc18ce] 1-10
                                                                                                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 805310) [0x1105909be] 1-10
                                                                                                    10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 53185668) [0x113784c84] 1-10
                                                                                                      10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 53134077) [0x1137782fd] 1-10
                                                                                                        10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1792902) [0x1102b5b86] 1-10
                                                                                                          10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1551358) [0x11027abfe] 1-10
                                                                                                            10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1405662) [0x1102572de] 1-10
                                                                                                              10  __psynch_mutexwait + 10 (libsystem_kernel.dylib + 105506) [0x7fffbb3fdc22] 1-10
                                                                                                               *10  psynch_mtxcontinue + 0 (pthread + 31211) [0xffffff7f8135f9eb] 1-10

  Thread 0x3418262          10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 54844474) [0x113919c3a] 1-10
          10  mach_msg_trap + 10 (libsystem_kernel.dylib + 74570) [0x7fffbb3f634a] 1-10
           *10  ipc_mqueue_receive_continue + 0 (kernel + 850080) [0xffffff80002cf8a0] 1-10

  Thread 0x341827a          Thread name "Gecko_IOThread"                        10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5336378) [0x1109e2d3a] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5353785) [0x1109e7139] 1-10
            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5313307) [0x1109dd31b] 1-10
              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5319228) [0x1109dea3c] 1-10
                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5401591) [0x1109f2bf7] 1-10
                  10  kevent + 10 (libsystem_kernel.dylib + 109974) [0x7fffbb3fed96] 1-10
                   *10  ??? (kernel + 5622912) [0xffffff800075cc80] 1-10

  Thread 0x341827d          Thread name "Timer"       10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1415483) [0x11025993b] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 737085) [0x11057ff3d] 1-10
            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5313307) [0x1109dd31b] 1-10
              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5543947) [0x110a1580b] 1-10
                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 781487) [0x11058acaf] 1-10
                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 744631) [0x110581cb7] 1-10
                    10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 724996) [0x11057d004] 1-10
                      10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58413) [0x10fe1b42d] 1-10
                        10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
                         *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x341827e          Thread name "Socket Thread"                         10 samples (1-10)         priority 47 (base 47)     cpu time 0.899
  <process frontmost, thread QoS user interactive (requested default, override user interactive), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1415483) [0x11025993b] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 737085) [0x11057ff3d] 1-10
            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5313307) [0x1109dd31b] 1-10
              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 5544026) [0x110a1585a] 1-10
                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 781487) [0x11058acaf] 1-10
                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 744631) [0x110581cb7] 1-10
                    10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 1486349) [0x110636e0d] 1-10
                      10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 1483060) [0x110636134] 1-10
                        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 1485215) [0x11063699f] 1-10
                          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 1463601) [0x110631531] 1-10
                            10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 1448098) [0x11062d8a2] 1-10
                              10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 4437997) [0x1109077ed] 1-10
                                10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 4419232) [0x110902ea0] 1-10
                                  10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 4416586) [0x11090244a] 1-10
                                    10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 53150241) [0x11377c221] 1-10
                                      10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 2114709) [0x110304495] 1-10
                                        10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 2099248) [0x110300830] 1-10
                                          10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 2005911) [0x1102e9b97] 1-10
                                            10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 2153897) [0x11030dda9] 1-10
                                              10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 2069725) [0x1102f94dd] 1-10
                                                10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1512740) [0x110271524] 1-10
                                                  10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1803140) [0x1102b8384] 1-10
                                                    10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1802135) [0x1102b7f97] 1-10
                                                      10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1801251) [0x1102b7c23] 1-10
                                                        10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1792902) [0x1102b5b86] 1-10
                                                          10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1551486) [0x11027ac7e] 1-10
                                                            10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1406536) [0x110257648] 1-10
                                                              10  __gettimeofday + 17 (libsystem_kernel.dylib + 103762) [0x7fffbb3fd552] (running) 1-10

  Thread 0x341827f          Thread name "JS Watchdog" 10 samples (1-10)         priority 31 (base 31)     cpu time <0.001
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1415483) [0x11025993b] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 8256032) [0x110caba20] 1-10
            10  ??? (<E136FCC2-685B-3A87-B25E-E79939FF81DA> + 1406536) [0x110257648] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x3418280          Thread name "JS Helper"   10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60653327) [0x113ea3f0f] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60630378) [0x113e9e56a] 1-10
            10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58176) [0x10fe1b340] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x3418281          Thread name "JS Helper"   10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60653327) [0x113ea3f0f] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60630378) [0x113e9e56a] 1-10
            10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58176) [0x10fe1b340] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x3418282          Thread name "JS Helper"   10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60653327) [0x113ea3f0f] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60630378) [0x113e9e56a] 1-10
            10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58176) [0x10fe1b340] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x3418283          Thread name "JS Helper"   10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60653327) [0x113ea3f0f] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60630378) [0x113e9e56a] 1-10
            10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58176) [0x10fe1b340] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x3418284          Thread name "JS Helper"   10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60653327) [0x113ea3f0f] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60630378) [0x113e9e56a] 1-10
            10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58176) [0x10fe1b340] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x3418285          Thread name "JS Helper"   10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60653327) [0x113ea3f0f] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60630378) [0x113e9e56a] 1-10
            10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58176) [0x10fe1b340] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10

  Thread 0x3418286          Thread name "JS Helper"   10 samples (1-10)         priority 31 (base 31)
  <process frontmost, thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [325], IO tier 0>
  10  thread_start + 13 (libsystem_pthread.dylib + 12429) [0x7fffbb4e808d] 1-10
    10  _pthread_start + 286 (libsystem_pthread.dylib + 14471) [0x7fffbb4e8887] 1-10
      10  _pthread_body + 180 (libsystem_pthread.dylib + 14651) [0x7fffbb4e893b] 1-10
        10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60653327) [0x113ea3f0f] 1-10
          10  ??? (<97AA044E-8776-34E1-A3EE-0835766A98A3> + 60630378) [0x113e9e56a] 1-10
            10  ??? (<963113B7-ACDD-38B6-8E39-B4F6C36552F0> + 58176) [0x10fe1b340] 1-10
              10  __psynch_cvwait + 10 (libsystem_kernel.dylib + 105458) [0x7fffbb3fdbf2] 1-10
               *10  psynch_cvcontinue + 0 (pthread + 38973) [0xffffff7f8136183d] 1-10
. . . . .

And this:

Date/Time:       2018-03-16 12:40:11.590208 -0400
OS Version:      Mac OS X 10.12.6 (Build 16G1212)
Architecture:    x86_64
Report Version:  19

Command:         firefox
Path:            /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox
Version:         60.0 (6018.3.12)
Parent:          launchd [1]
PID:             88276

Event:           cpu usage
CPU:             90s cpu time over 91 seconds (99% cpu average), exceeding limit of 50% cpu over 180 seconds
Duration:        91.27s
Steps:           42

Hardware model:  MacBookPro11,5
Active cpus:     8

Fan speed:       5279 rpm


Powerstats for:  firefox [88276]
UUID:            8165D46D-4F02-33D5-847A-6E29E078D4F1
Start time:      2018-03-16 12:40:13 -0400
End time:        2018-03-16 12:41:42 -0400
Microstackshots: 42 samples (100%)
Primary state:   17 samples Non-Frontmost App, User mode, Effective Thread QoS User Interactive, Requested Thread QoS Default, Override Thread QoS User Interactive
User Activity:   0 samples Idle, 42 samples Active
Power Source:    0 samples on Battery, 42 samples on AC
  38 thread_start + 13 (libsystem_pthread.dylib) [0x7fffbb4e808d]
    38 _pthread_start + 286 (libsystem_pthread.dylib) [0x7fffbb4e8887]
      38 _pthread_body + 180 (libsystem_pthread.dylib) [0x7fffbb4e893b]
        37 _pt_root + 203 (libnss3.dylib) [0x10315993b]
          36 nsThread::ThreadFunc(void*) + 557 (XUL) [0x105eb6f3d]
            36 MessageLoop::Run() + 75 (XUL) [0x10631431b]
              36 mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) + 155 (XUL) [0x10634c80b]
                36 NS_ProcessNextEvent(nsIThread*, bool) + 47 (XUL) [0x105ec1caf]
                  36 nsThread::ProcessNextEvent(bool, bool*) + 1527 (XUL) [0x105eb8cb7]
                    36 non-virtual thunk to nsThreadPool::Run() + 13 (XUL) [0x105ebb87d]
                      36 nsThreadPool::Run() + 1087 (XUL) [0x105ebb7bf]
                        36 mozilla::psm::(anonymous namespace)::SSLServerCertVerificationJob::Run() + 123 (XUL) [0x10908df4b]
                          36 mozilla::psm::(anonymous namespace)::AuthCertificate(mozilla::psm::CertVerifier&, nsNSSSocketInfo*, std::__1::unique_ptr<CERTCertificateStr, mozilla::UniqueCERTCertificateDeletePolicy> const&, std::__1::unique_ptr<CERTCertListStr, mozilla::UniqueCERTCertListDeletePolicy>&, SECItemStr const*, SECItemStr const*, unsigned int, mozilla::pkix::Time) + 363 (XUL) [0x109086d0b]
                            36 mozilla::psm::CertVerifier::VerifySSLServerCert(std::__1::unique_ptr<CERTCertificateStr, mozilla::UniqueCERTCertificateDeletePolicy> const&, SECItemStr const*, SECItemStr const*, mozilla::pkix::Time, void*, nsTSubstring<char> const&, std::__1::unique_ptr<CERTCertListStr, mozilla::UniqueCERTCertListDeletePolicy>&, bool, unsigned int, mozilla::OriginAttributes const&, SECOidTag*, mozilla::psm::CertVerifier::OCSPStaplingStatus*, mozilla::psm::KeySizeStatus*, mozilla::psm::SHA1ModeResult*, mozilla::psm::PinningTelemetryInfo*, mozilla::psm::CertificateTransparencyInfo*) + 186 (XUL) [0x105e0a08a]
                              36 mozilla::psm::CertVerifier::VerifyCert(CERTCertificateStr*, long long, mozilla::pkix::Time, void*, char const*, std::__1::unique_ptr<CERTCertListStr, mozilla::UniqueCERTCertListDeletePolicy>&, unsigned int, SECItemStr const*, SECItemStr const*, mozilla::OriginAttributes const&, SECOidTag*, mozilla::psm::CertVerifier::OCSPStaplingStatus*, mozilla::psm::KeySizeStatus*, mozilla::psm::SHA1ModeResult*, mozilla::psm::PinningTelemetryInfo*, mozilla::psm::CertificateTransparencyInfo*) + 278 (XUL) [0x105e08c96]
                                36 nsNSSComponent::CheckForSmartCardChanges() + 253 (XUL) [0x1090af2fd]
                                  36 pk11_IsPresentCertLoad + 102 (libnss3.dylib) [0x1031b5b86]
                                    36 nssSlot_IsTokenPresent + 238 (libnss3.dylib) [0x10317ac7e]
                                      29 PR_WaitCondVar + 232 (libnss3.dylib) [0x103157648]
                                        26 __gettimeofday + 17 (libsystem_kernel.dylib) [0x7fffbb3fd552]
                                          15 <Kernel mode>
                                          2  <Frontmost App>
                                          1  <Frontmost App, Effective Thread QoS Default, Override Thread QoS Default>
                                          1  <Frontmost App, Kernel mode, Effective Thread QoS Default, Override Thread QoS Default>
                                          1  <Frontmost App, Kernel mode>
                                        2  _pthread_cond_wait + 225 (libsystem_pthread.dylib) [0x7fffbb4e9613]
                                          1  <Frontmost App>
                                        1  _pthread_cond_wait + 847 (libsystem_pthread.dylib) [0x7fffbb4e9881]
                                      3  PR_WaitCondVar + 153 (libnss3.dylib) [0x1031575f9]
                                        3  mig_allocate + 69 (libsystem_kernel.dylib) [0x7fffbb3f6510]
                                      2  PR_WaitCondVar + 27 (libnss3.dylib) [0x10315757b]
                                        2  PR_GetCurrentThread + 32 (libnss3.dylib) [0x1031588c0]
                                          2  <Frontmost App>
                                      2  _PR_Mach_GetInterval + 64 (libnss3.dylib) [0x10313f310]
          1  mozilla::net::CacheIOThread::ThreadFunc(void*) + 36 (XUL) [0x106169e74]
            1  mozilla::net::CacheIOThread::ThreadFunc() + 408 (XUL) [0x10616a238]
              1  mozilla::net::CacheIOThread::LoopOneLevel(unsigned int) + 290 (XUL) [0x10616a442]
                1  mozilla::net::CacheIndex::Run() + 299 (XUL) [0x10617237b]
                  1  mozilla::net::CacheIndex::UpdateIndex() + 1116 (XUL) [0x10617117c]
                    1  access + 10 (libsystem_kernel.dylib) [0x7fffbb3fe4ae]
                      1  <Frontmost App, Kernel mode, Effective Thread QoS Default, Override Thread QoS Unspecified>
        1  CVDisplayLink::runIOThread() + 520 (CoreVideo) [0x7fffa7204762]
          1  CVDisplayLink::waitUntil(unsigned long long) + 233 (CoreVideo) [0x7fffa7204977]
            1  __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fffbb3fdbf2]
              1  <Frontmost App, Kernel mode, Effective Thread QoS Unspecified, Requested Thread QoS Unspecified, Override Thread QoS Unspecified>
  4  ??? [0]
    2  __commpage_gettimeofday + 17 (libsystem_kernel.dylib) [0x7fffbb3f6521]
    1  __commpage_gettimeofday + 83 (libsystem_kernel.dylib) [0x7fffbb3f6563]
    1  __commpage_gettimeofday + 31 (libsystem_kernel.dylib) [0x7fffbb3f652f]

  Binary Images:
         0x102d45000 -        0x102d46fff  org.mozilla.firefoxdeveloperedition 60.0 (6018.3.12) <8165D46D-4F02-33D5-847A-6E29E078D4F1> /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox
         0x103000000 -        0x103266ff7  libnss3.dylib (1) <E136FCC2-685B-3A87-B25E-E79939FF81DA> /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/libnss3.dylib
         0x105e03000 -        0x10ad7cf1f  XUL (1) <97AA044E-8776-34E1-A3EE-0835766A98A3> /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/XUL
      0x7fffa71fd000 -     0x7fffa7232ff3  com.apple.CoreVideo 1.8 (235.3) <AC11D5FB-C77B-34F5-B942-F698E84C229F> /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo
      0x7fffbb3e4000 -     0x7fffbb406ff7  libsystem_kernel.dylib (3789.73.8) <7F77BDE8-93F4-3A2D-B864-95AE10DCEA60> /usr/lib/system/libsystem_kernel.dylib
      0x7fffbb4e5000 -     0x7fffbb4efff7  libsystem_pthread.dylib (218.60.3) <B8FB5E20-3295-39E2-B5EB-B464D1D4B104> /usr/lib/system/libsystem_pthread.dylib

@mouse07410
Copy link
Contributor

Actually, with Firefox-60 it's bad. It hung as soon as I started typing the URL, even before the CAC was inserted.

OPENSC_DEBUG when the system did even have a chance to talk to the card (card was not inserted yet):
firefox-opensc.log.txt

OPENSC_DEBUG (using PIV driver) when I got to the CAC-protected web site, and inserted CAC to authenticate:
firefox-opensc.log2.txt

Same as above - but using CAC driver:
firefox-opensc.log3.txt

If I start Firefox when the CAC is already inserted - everything works fine:
firefox-opensc.log4.txt
The log is for the car driver - but it works fine with PIV driver too, in this case.

@dengert
Copy link
Member

dengert commented Mar 16, 2018 via email

@mouse07410
Copy link
Contributor

I recall Mouse saying some PIV card would only do one challenge

I think I saw different PIV tokens exhibited different behavior here. :-(

Is Firefox now requeating random data when it did not before?

I don't know. It does look like Firefox now does something different - because the older versions work fine with the same version of OpenSC and the same tokens.

As I said before can you try modifying driver to not saying it can generate
random numbers.

I would really hate this, unless it is configurable via, e.g., opens.conf, and hopefully, on a per-token-type basis. So I would be able to get random numbers fro those PIV tokens that behave correctly, but I could make the driver not expose this functionality for those tokens (like CAC) that are known to fail. Actually, older CAC didn't seem to have a problem generating random data, as I recall!

@dengert
Copy link
Member

dengert commented Mar 16, 2018 via email

@mouse07410
Copy link
Contributor

If firefox is requesting random number and we can not provide it, maybe we
are returning the wrong CKR_ code.

This sounds right.

We could look at for cards in question:

  • Dont advertise the card can return random numbers to start with.
  • Or return software generated random number
  • Or return some other CKR like not supported

I'd say: if you recognized that this card is known to fail C_GenerateRandom - return some CKR_<not supported>. The current CKR_DATA_INVALID return code is highly misleading.

A question here: in the SPY log I did not see where the amount of random data required was passed to the card. Could you point me at the place where the card is informed how many random bytes it's supposed to produce?

Is this a MacOS problem only?

If I understood the original reporter correctly - this problem exists on Linux (at least) as well.

Can someone look at the Firefox source to see what it does with a bad CKR in this case?

Somebody should. Sorry, not me.

@frankmorgner
Copy link
Member

@mouse07410 could you try to apply #1249? The PR allows fixed size responses on the card driver level (as returned by the PIV card) while still returning the correct amount of random data on the application level (i.e. to Firefox).

@frankmorgner frankmorgner added this to In progress in Release 0.18.0 Mar 19, 2018
@frankmorgner frankmorgner moved this from In progress to To do in Release 0.18.0 Mar 19, 2018
@Jakuje
Copy link
Member

Jakuje commented Mar 19, 2018

That would make sense, that the first request would work, but not the second, since for random data, the GET_CHALLENGE instruction is "misused". But from the logs, I see that the get_challenge functions are called just once throughout all the logs.

I still can not isolate the reproducer no reproduce it with any of my cards. I am starting with the card inserted in the reader, which might be the problem. But using C_WaitForSlotEvent and inserting the card later did not help me with reproducing the issue.

It looks like some issue of the Firefox itself, because I see a <defunct> process in the process tree, when I booted up a latest Nightly and encountered the freeze (don't get confused by the version in the path -- it is just old directory that I got updated to latest Nightly):

jjelen   11879 24.2  2.1 2403340 345272 pts/8  Sl+  15:40   0:37  |   \_ /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/firefox
jjelen   12171  0.0  0.0      0     0 pts/8    Z+   15:40   0:00  |       \_ [firefox] <defunct>
jjelen   12267  1.9  0.9 1839296 145280 pts/8  Sl+  15:40   0:02  |       \_ /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 65 -schedulerPrefs 0001,2 -greomni /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/omni.ja -appomni /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/browser/omni.ja -appdir /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/browser 11879 true tab
jjelen   12349  1.4  0.6 1764916 111728 pts/8  Sl+  15:40   0:01  |       \_ /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 65 -schedulerPrefs 0001,2 -greomni /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/omni.ja -appomni /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/browser/omni.ja -appdir /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/browser 11879 true tab
jjelen   12386  0.2  0.4 1706144 74816 pts/8   Sl+  15:40   0:00  |       \_ /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 65 -schedulerPrefs 0001,2 -greomni /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/omni.ja -appomni /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/browser/omni.ja -appdir /home/jjelen/Downloads/firefox-58.0a1.en-US.linux-x86_64/firefox/browser 11879 true tab

@Jakuje
Copy link
Member

Jakuje commented Mar 19, 2018

Ok, on the second try, I don't see the defunct process, but the hang persists. Using the #1249 does not change anything and process still hangs. The backtraces of all the processes point someplace deep in the wait routines of Firefox. I used just standard PIV test cards to reproduce the issue on Linux.

I can not reproduce it with default Firefox 59.0 in Fedora 27.

But colleagues managed to reproduce it even with Firefox 52 [1] so this makes me think that the issue is somewhere deep in NSS (which I believe they got that one updated).

I will have to dig into that deeper.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1557015

@mouse07410
Copy link
Contributor

@mouse07410 could you try to apply #1249?

Yes. I applied #1249 and tried using CAC with Firefox 60 (Dev Edition). Same thing: even when I start FF with CAC already inserted (which used to work more often than not), whenever I to go Preferences -> Security -> Certificates (or -> Devices) FF hangs up.

@Jakuje
Copy link
Member

Jakuje commented Mar 21, 2018

That really sounds like an issue of Firefox. Did anybody already tried to fill a bug in their bugzilla? I would be glad to do that but I was not able to collect any reasonable information from Firefox yet.

I can reproduce it with Nightly and coolkey, but not with softhsm (it loads the certificates properly).

@frankmorgner frankmorgner removed this from To do in Release 0.18.0 Mar 21, 2018
@Jakuje
Copy link
Member

Jakuje commented Mar 21, 2018

The reproducer:

  • Remove card from reader
  • Start a specific Nightly version
  • Add a PKCS#11 provider to Firefox
  • Insert a card in reader
  • Click "View Certificates"
  • Wait for PIN prompt -- it either freezes or not

Playing with mozregresion:

  • Firefox Nightly from 2018-01-01 (and before) works fine
  • Firefox Nightly from 2018-02-01 (and after) freezes

First I tried to work with an existing profile, but this makes the testing unreliable. The following with always-clean profile worked:

mozregression --bad 2018-02-01 --good 2018-01-01

The led me to the date 2018-01-23, when the issue started occurring (builds before this date work and after do not). Going further brings me to the commit bumping NSS release, which is not very useful:

https://hg.mozilla.org/integration/mozilla-inbound/rev/348b36156a84

I filled the following bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=1447628

@mouse07410
Copy link
Contributor

@Jakuje how do I get the latest NSS? Is there an analog to Github, and what are the commands to get it?

@Jakuje
Copy link
Member

Jakuje commented Mar 27, 2018

You can get latest NSS with Firefox Nightly: http://nightly.mozilla.org/
It bundles the latest NSS. If you will try my reproducer with the latest release, to make sure it is properly fixed, it would be great.

@mouse07410
Copy link
Contributor

...It bundles the latest NSS

I want the latest source NSS to build myself.

If you will try my reproducer with the latest release...

I'm afraid your reproducer still reproduces the problem. Firefox/NSS is not fixed yet, AFAICT.

@dengert
Copy link
Member

dengert commented Mar 27, 2018 via email

@Jakuje
Copy link
Member

Jakuje commented Mar 27, 2018

@mouse07410 Instructions how to build NSS itself are here:

http://www.mozilla.org/projects/security/pki/nss/

But then you would have to modify also your firefox to use this version, instead of the bundled one.

If I see right, the new NSS was not yet merged in the lastest Firefox, so it is not yet in nightly:

https://bugzilla.mozilla.org/show_bug.cgi?id=1448404

@dengert No, the freeze was not related to OpenSC at all. I reproduced it also with different pkcs11 modules. It was only the first assumption, because it froze after the last (and only) call to C_GenerateRandom().

@dengert
Copy link
Member

dengert commented Mar 28, 2018

OK, C_GenerateRandom was a read herring.

There is a Github version of the Mozilla source:
https://developer.mozilla.org/en-US/docs/Mozilla/Mozilla_on_GitHub

which leads to https://github.com/mozilla/gecko-dev

I see updates from yesterday and in security/nss There are updates from 2 days ago and references to NSS 3_36-Beta3.

So this might be an easy way to build it or at least see the source code.

@dengert
Copy link
Member

dengert commented Mar 30, 2018

I built FireFox from git on Ubuntu-16.4 (VirtualBox client, Windows 10 host) yesterday.

Starting firefox (./mach run) then using NIST PIV demo card:

  • If card is in reader when reader is attached to VM, I can read certificates. (Did not try and use them)

  • If reader already attached but card not in reader, I can see security device and the reader. But when card is inserted FireFox hangs.

Based on your comment about softhsm works, but opensc with coolkey does not, could this be a timing or tread/mutex problem? The softhsm is all in software so may initialize quickley. The OpenSC does
lot of IO to the cards, giving NSS time to try and use a pkcs11 session before the card may be full initialized.

OpenSC may be missing some locks in the code or we have a deadlock. As far as I can tell, OpenSC does not log uses of the mutex when the application supplies the routines. We could add some debugging.
pkcs11-global.c says "Based on PKCS#11 v2.11 11.4" .

@Jakuje
Copy link
Member

Jakuje commented Mar 30, 2018

@dengert I did not try the card-insertion use case with softhsm, mostly out of my laziness. Feel free to reproduce the issue with softhsm. I don't think this is issue of OpenSC.
As mentioned in the second linked bug, the latest NSS release was not yet merged in Firefox and therefore the bug is still present.

@krutelp
Copy link

krutelp commented Apr 4, 2018

Running Linux openSUSE Leap 42.3 . Update to NSS 3.36 affected Thunderbird and Chrome too. Symptoms are the same or similar as in Firefox - when inserting card during application run and card is accessed, app freezes. Waiting for NSS 3.36.1 as described in https://bugzilla.mozilla.org/show_bug.cgi?id=1447628

@Jakuje
Copy link
Member

Jakuje commented Apr 10, 2018

The latest NSS is merged in Firefox and this issue can be closed.

@frankmorgner
Copy link
Member

great, thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants