Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Issue 10539144: Always initialize session cache locks lazily. (Closed)

Created:
8 years, 6 months ago by wtc
Modified:
5 years, 7 months ago
Reviewers:
Ryan Sleevi
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

Always initialize session cache locks lazily. Code analysis shows it is sufficient to initialize session cache locks lazily before we create an sslSocket because the two locks are always used with an sslSocket 'ss', except when we clear session caches. This matches our expectation that only SSL sockets use the SSL session cache. R=rsleevi@chromium.org BUG=131622 TEST=no crashes due to null pointer dereference inside NSS SSL code.

Patch Set 1 #

Total comments: 2

Patch Set 2 : Remove unrelated cleanup #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+21 lines, -59 lines) Patch
M net/third_party/nss/ssl/ssl3con.c View 2 chunks +0 lines, -3 lines 0 comments Download
M net/third_party/nss/ssl/sslimpl.h View 1 1 chunk +1 line, -3 lines 0 comments Download
M net/third_party/nss/ssl/sslnonce.c View 5 chunks +8 lines, -49 lines 0 comments Download
M net/third_party/nss/ssl/sslsnce.c View 3 chunks +0 lines, -4 lines 1 comment Download
M net/third_party/nss/ssl/sslsock.c View 1 1 chunk +12 lines, -0 lines 1 comment Download

Messages

Total messages: 2 (0 generated)
wtc
rsleevi: I decided to create an NSS patch that can be upstreamed. The net::EnableSSLServerSockets() calls ...
8 years, 6 months ago (2012-06-13 23:08:21 UTC) #1
Ryan Sleevi
8 years, 6 months ago (2012-06-14 01:23:34 UTC) #2
This won't help use_system_ssl users (should we just remove this support
entirely for Linux? Shall we talk with phajdan.jr?)

At a high level view, I agree that there's some potential abstraction leaking -
but do you think it's any different then the fact that code like content/ or the
renderer/ have to ensure NSS is initialized in the sandbox?

We can certainly hide the dependency through wrapper functions
(remoting::InitRemoting() -> net::EnableSSLServerSockets, etc), but I don't
think the idea of "functions you need to call early" is particularly anathema
(eg: CommandLine, AtExitManager, etc)

Is PR_CallOnce somehow heavier than our LazyInstance and friends?

If so, we should consider upstreaming that. LazyInstance uses an atomic compare
and swap on the platforms that support it (eg: all the ones we care about). Even
if it means PR_CallOnce needs to be slow on platforms like CE?Solaris/insert
edge case here, I think we'd be better off optimizing PR_CallOnce and calling it
when needed rather than relying on the correct order of operations.

https://chromiumcodereview.appspot.com/10539144/diff/1006/net/third_party/nss...
File net/third_party/nss/ssl/sslsnce.c (left):

https://chromiumcodereview.appspot.com/10539144/diff/1006/net/third_party/nss...
net/third_party/nss/ssl/sslsnce.c:1494: ssl_InitSessionCacheLocks(PR_FALSE);
I don't believe this is correct.

Because the server process needs to configure the cache, it should be
initializing the cache locks, not lazily in the socket import.

https://chromiumcodereview.appspot.com/10539144/diff/1006/net/third_party/nss...
File net/third_party/nss/ssl/sslsock.c (right):

https://chromiumcodereview.appspot.com/10539144/diff/1006/net/third_party/nss...
net/third_party/nss/ssl/sslsock.c:1406: */
See my other comment - I don't think this is correct/expected.

Powered by Google App Engine
This is Rietveld 408576698