Commit 4ddc4520 authored by Matt Mueller's avatar Matt Mueller Committed by Commit Bot

Remove PR_DetachThread from multi_threaded_cert_verifier.

PR_DetachThread is not necessary, because Chromium code
never calls PR_Cleanup (which requires threads be cleaned up
beforehand), and the thread-specific data itself will be
cleaned up by NSPR's pthreads hook. However, PR_DetachThread
can cause a crash if NSS hasn't been initialized at all
(e.g. with use_byte_certs=true in unittests), so it's not
just unnecessary, but actively harmful.

Bug: 671420
Change-Id: I294ac988c53c7b5109b80eec2aef547cb46f650a
Reviewed-on: https://chromium-review.googlesource.com/558605Reviewed-by: default avatarRyan Sleevi <rsleevi@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488734}
parent 8c2aef8e
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
#include "net/log/net_log_source_type.h" #include "net/log/net_log_source_type.h"
#include "net/log/net_log_with_source.h" #include "net/log/net_log_with_source.h"
#if defined(USE_NSS_CERTS)
#include <private/pprthred.h> // PR_DetachThread
#endif
namespace net { namespace net {
class NetLogCaptureMode; class NetLogCaptureMode;
...@@ -193,17 +189,6 @@ void DoVerifyOnWorkerThread(const scoped_refptr<CertVerifyProc>& verify_proc, ...@@ -193,17 +189,6 @@ void DoVerifyOnWorkerThread(const scoped_refptr<CertVerifyProc>& verify_proc,
TRACE_EVENT0(kNetTracingCategory, "DoVerifyOnWorkerThread"); TRACE_EVENT0(kNetTracingCategory, "DoVerifyOnWorkerThread");
*error = verify_proc->Verify(cert.get(), hostname, ocsp_response, flags, *error = verify_proc->Verify(cert.get(), hostname, ocsp_response, flags,
crl_set.get(), additional_trust_anchors, result); crl_set.get(), additional_trust_anchors, result);
#if defined(USE_NSS_CERTS)
// Detach the thread from NSPR.
// Calling NSS functions attaches the thread to NSPR, which stores
// the NSPR thread ID in thread-specific data.
// The threads in our thread pool terminate after we have called
// PR_Cleanup. Unless we detach them from NSPR, net_unittests gets
// segfaults on shutdown when the threads' thread-specific data
// destructors run.
PR_DetachThread();
#endif
} }
// CertVerifierJob lives only on the verifier's origin message loop. // CertVerifierJob lives only on the verifier's origin message loop.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment