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

Issue 2944008: Refactor X509Certificate caching to cache the OS handle, rather than the X509Certificate (Closed)

Created:
10 years, 5 months ago by Ryan Sleevi
Modified:
9 years, 5 months ago
Reviewers:
agl, bulach, wtc, Chris Evans
CC:
chromium-reviews, cbentzel+watch_chromium.org, ben+cc_chromium.org, John Grabowski, darin-cc_chromium.org, Paweł Hajdan Jr., pam+watch_chromium.org
Visibility:
Public.

Description

Cache the underlying OS certificate handle within the X509CertificateCache, rather than caching raw X509Certificate pointers. TEST=X509CertificateTest.Cache, X509CertificateTest.Intermediates BUG=32623, 47648, 49377, 68448, 70216, 77374, 78038 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=92977

Patch Set 1 : Initial patch #

Total comments: 1

Patch Set 2 : Rebase to trunk #

Patch Set 3 : Change the cache to cache by individual OSCertHandles, rather than by chains #

Total comments: 9

Patch Set 4 : Rebase to trunk #

Patch Set 5 : cleanup and address wtc's comments #

Patch Set 6 : Fix a leak of intermediate certificates when using SChannel #

Patch Set 7 : #

Patch Set 8 : Rebase to trunk, now that several changes to X509 have landed #

Patch Set 9 : Fix HTTPSRequestTest.HTTPSMismatchedTest, which was relying on the cache to return the same pointer #

Patch Set 10 : Rebase to trunk - without implementing OpenSSL versions #

Patch Set 11 : OpenSSL implementation and cleanup of serialization/deserialization #

Total comments: 24

Patch Set 12 : Address feedback from bulach #

Patch Set 13 : Rebase to trunk after splitting out 4645001 #

Total comments: 2

Patch Set 14 : Rebase to trunk #

Patch Set 15 : Rebase and cleanup #

Patch Set 16 : Removed unnecessary bits #

Total comments: 22

Patch Set 17 : Rebase #

Patch Set 18 : Feedback #

Total comments: 5

Patch Set 19 : Rebase before commit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+208 lines, -316 lines) Patch
M net/base/cert_database_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -3 lines 0 comments Download
M net/base/cert_database_nss_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -5 lines 0 comments Download
M net/base/x509_certificate.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 8 chunks +13 lines, -42 lines 0 comments Download
M net/base/x509_certificate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 9 chunks +137 lines, -95 lines 0 comments Download
M net/base/x509_certificate_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +3 lines, -8 lines 0 comments Download
M net/base/x509_certificate_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -2 lines 0 comments Download
M net/base/x509_certificate_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 11 chunks +31 lines, -70 lines 0 comments Download
M net/base/x509_certificate_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +1 line, -34 lines 0 comments Download
M net/socket/ssl_client_socket_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -2 lines 0 comments Download
M net/socket/ssl_client_socket_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +7 lines, -10 lines 0 comments Download
M net/socket/ssl_client_socket_openssl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -2 lines 0 comments Download
M net/socket/ssl_client_socket_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +9 lines, -43 lines 0 comments Download

Messages

Total messages: 30 (0 generated)
Ryan Sleevi
Wan-Teh, David, This is a precondition to cleaning up the chain building logic across the ...
10 years, 5 months ago (2010-07-11 07:14:09 UTC) #1
Ryan Sleevi
Wan-Teh, I believe this may offer an alternate solution to the race condition problem of ...
10 years, 5 months ago (2010-07-18 01:32:23 UTC) #2
wtc
Ryan, Thanks a lot for writing this CL to fix several long-standing bugs! One problem ...
10 years, 5 months ago (2010-07-20 23:25:56 UTC) #3
Ryan Sleevi
Understandably, I don't wish to drop large CLs anymore than I want to read. With ...
10 years, 5 months ago (2010-07-21 01:46:26 UTC) #4
Ryan Sleevi
I've rolled to ToT and cleaned up the areas that Wan-Teh mentioned, as well as ...
10 years, 4 months ago (2010-08-15 13:10:16 UTC) #5
wtc
rsleevi: thanks a lot for improving this CL. I will review it later this week. ...
10 years, 4 months ago (2010-08-17 23:45:14 UTC) #6
Ryan Sleevi
On 2010/08/17 23:45:14, wtc wrote: > rsleevi: thanks a lot for improving this CL. > ...
10 years, 2 months ago (2010-10-10 02:21:06 UTC) #7
bulach
thanks Ryan! I'm not yet too familiar with this code, so my review is mostly ...
10 years, 2 months ago (2010-10-20 14:50:11 UTC) #8
Ryan Sleevi
@bulach: Thanks for taking a look at this! I've updated quite a bit of the ...
10 years, 2 months ago (2010-10-23 05:56:40 UTC) #9
wtc
On 2010/10/23 05:56:40, rsleevi wrote: > > @wtc: > I added http://crbug.com/60256 to notes on ...
10 years, 2 months ago (2010-10-25 23:56:43 UTC) #10
Ryan Sleevi
On 2010/10/25 23:56:43, wtc wrote: > On 2010/10/23 05:56:40, rsleevi wrote: > > > > ...
10 years, 2 months ago (2010-10-26 00:02:32 UTC) #11
wtc
On 2010/10/26 00:02:32, rsleevi wrote: > > When I initially did so, when first submitting ...
10 years, 2 months ago (2010-10-26 00:33:38 UTC) #12
Ryan Sleevi
wtc: I've re-based and re-uploaded this CL, with the cache logic split out per your ...
9 years, 11 months ago (2011-01-13 04:32:27 UTC) #13
agl
This CL seems to have died, but still seems useful. Ryan: did you want to ...
9 years, 8 months ago (2011-04-11 16:50:49 UTC) #14
Ryan Sleevi
agl: I've been waiting (but perhaps not nagging) on wtc's review, given that it touches ...
9 years, 8 months ago (2011-04-12 00:15:09 UTC) #15
agl
It's already been several rounds with wtc, I think this is good to go. LGTM.
9 years, 8 months ago (2011-04-12 14:54:57 UTC) #16
wtc
On 2011/04/12 14:54:57, agl wrote: > It's already been several rounds with wtc, I think ...
9 years, 8 months ago (2011-04-20 18:06:49 UTC) #17
Ryan Sleevi
On 2011/04/20 18:06:49, wtc wrote: > On 2011/04/12 14:54:57, agl wrote: > > It's already ...
9 years, 8 months ago (2011-04-20 22:31:56 UTC) #18
Ryan Sleevi
wtc: Ping
9 years, 6 months ago (2011-06-21 04:26:21 UTC) #19
Ryan Sleevi
wtc: I've updated this to ToT and split out some more changes that can/should otherwise ...
9 years, 5 months ago (2011-07-07 07:03:56 UTC) #20
Chris Evans
wtc: another ping? On 2011/07/07 07:03:56, Ryan Sleevi wrote: > wtc: I've updated this to ...
9 years, 5 months ago (2011-07-14 22:42:49 UTC) #21
wtc
rsleevi: I have read the whole CL. I summarized that it contains three main changes: ...
9 years, 5 months ago (2011-07-16 00:54:54 UTC) #22
Ryan Sleevi
On 2011/07/16 00:54:54, wtc wrote: > rsleevi: I have read the whole CL. I summarized ...
9 years, 5 months ago (2011-07-16 01:24:22 UTC) #23
wtc
LGTM. High-Level Comments (both of which you can ignore) 1. Ideally CreateOSCertHandleFromBytes and CreateOSCertHandlesFromBytes (note ...
9 years, 5 months ago (2011-07-17 01:55:32 UTC) #24
Ryan Sleevi
wtc: Thanks for reviewing. Since you raised a point about a possible bug/leak, I wanted ...
9 years, 5 months ago (2011-07-17 03:52:22 UTC) #25
wtc
http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate.cc File net/base/x509_certificate.cc (right): http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate.cc#newcode617 net/base/x509_certificate.cc:617: } rsleevi: I hope I didn't misunderstand your code. ...
9 years, 5 months ago (2011-07-17 14:39:54 UTC) #26
wtc
http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate.cc File net/base/x509_certificate.cc (right): http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate.cc#newcode617 net/base/x509_certificate.cc:617: } On 2011/07/17 14:39:54, wtc wrote: > > Therefore, ...
9 years, 5 months ago (2011-07-17 15:11:49 UTC) #27
wtc
http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate.cc File net/base/x509_certificate.cc (right): http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate.cc#newcode172 net/base/x509_certificate.cc:172: } I suggest the following: X509Certificate::OSCertHandle old_handle = NULL; ...
9 years, 5 months ago (2011-07-17 15:26:19 UTC) #28
Ryan Sleevi
wtc: I'm glad you saw where they balanced. I've omitted making your suggested change, because ...
9 years, 5 months ago (2011-07-17 23:43:30 UTC) #29
wtc
9 years, 5 months ago (2011-07-18 22:20:26 UTC) #30
http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate.cc
File net/base/x509_certificate.cc (right):

http://codereview.chromium.org/2944008/diff/236003/net/base/x509_certificate....
net/base/x509_certificate.cc:172: }
rsleevi: you're right.  My proposed code relies on
Entry::ref_count being >= 1 before returning from
InsertOrUpdate.  With hash collision of certificates this
is not true.

It is surprising that an X509Certificate object that did not
increment Entry::ref_count can decrement Entry::ref_count
because of hash collision, i.e., a certificate can be the
losing cert in InsertOrUpdate but be the winning cert in Remove,
and vice versa.

I think your explanation that this will still work out
OK is correct.

Powered by Google App Engine
This is Rietveld 408576698