Closed Bug 1798150 Opened 4 years ago Closed 4 years ago

Add on-demand SECOID table initialization as a workaround for Android PGO build bug

Categories

(NSS :: Libraries, defect, P1)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jschanck, Assigned: jschanck)

References

Details

(Whiteboard: [nss-fx])

Attachments

(1 external file)

The patch for Bug 1754746 changes how we build and link the PSM tlsserver test binaries, and now we're seeing a segfault in GenerateOCSPResponse that only manifests in Android builds with Profile Guided Optimization (PGO) enabled.

Treeherder: https://treeherder.mozilla.org/jobs?repo=try&revision=22fcbc2a1499121635ca4c9800a701629263e3d7&searchStr=X2

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Android/sdk_phone_x86_64/generic_x86_64:7.0/NYC/4174735:userdebug/test-keys'
Revision: '0'
ABI: 'x86_64'
pid: 8158, tid: 8158, name: GenerateOCSPRes  >>> /data/local/tmp/test_root/xpcb/GenerateOCSPResponse <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
    rax 0000000000000008  rbx 00007fffb1e1e158  rcx 0000000000010fc3  rdx 0000000000000002
    rsi 00000000000003a8  rdi 00000000000003a8
    r8  0000000000000100  r9  00002d3b23da3f3f  r10 0000000000000002  r11 00007fffb1e1e1e8
    r12 0000000000000000  r13 0000000000000010  r14 00000000000003a8  r15 00000000ffffffff
    cs  0000000000000033  ss  000000000000002b
    rip 000073feebeb0204  rbp 00007fffb1e1df20  rsp 00007fffb1e1def0  eflags 0000000000000206

backtrace:
    #00 pc 0000000000123204  /data/local/tmp/test_root/xpcb/libnss3.so (offset 0x15000)
    #01 pc 000000000011d385  /data/local/tmp/test_root/xpcb/libnss3.so (offset 0x15000)
    #02 pc 000000000001624e  /data/local/tmp/test_root/xpcb/libsoftokn3.so (offset 0x3000)
    #03 pc 00000000000420e3  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (pk11_TokenKeyGenWithFlagsAndKeyType+844)
    #04 pc 0000000000040730  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (pk11_RawPBEKeyGenWithKeyType+176)
    #05 pc 0000000000040867  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (PK11_PBEKeyGen+303)
    #06 pc 000000000002ef21  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (PK11_ExportEncryptedPrivKeyInfoV2+237)
    #07 pc 000000000002f1b3  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (PK11_ExportEncryptedPrivKeyInfo+27)
    #08 pc 0000000000020815  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (_ZN7mozilla4pkix4test17CreateTestKeyPairENS1_22TestPublicKeyAlgorithmERKNSt6__ndk110unique_ptrI18SECKEYPublicKeyStr17ScopedMaybeDeleteIS5_EEERKNS4_I19SECKEYPrivateKeyStrS6_ISB_EEE+125)
    #09 pc 0000000000018fd1  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (_Z22GetOCSPResponseForType16OCSPResponseTypeRKNSt6__ndk110unique_ptrI18CERTCertificateStrN7mozilla33UniqueCERTCertificateDeletePolicyEEERKNS1_I11PLArenaPoolNS3_29UniquePLArenaPoolDeletePolicyEEEPKcl+1225)
    #10 pc 0000000000018923  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (main+267)
    #11 pc 000000000001c8d4  /system/lib64/libc.so (__libc_init+84)
    #12 pc 00000000000187e7  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (_start_main+55)
    #13 pc 00000000000187ab  /data/local/tmp/test_root/xpcb/GenerateOCSPResponse (_start+11)

I recognized the 0x10 fault address from crashes in SECOID_FindOID, and I was able to confirm that the segfault in GenerateOCSPResponse is in SECOID_FindOIDByMechanism using a debugger.

We should identify and fix the root cause as part of the ongoing review of nssutil, but in the meantime I'd like to add a workaround where we perform a null check in the SECOID_FindOID functions and initialize the hash tables on-demand if necessary. I've confirmed that this fixes the problem in try.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: