Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Issue 2411033003: Drop buffers in idle SSLClientSockets (and SSLServerSockets). (Closed)

Created:
4 years, 2 months ago by davidben
Modified:
4 years, 2 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, xunjieli
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Drop buffers in idle SSLClientSockets (and SSLServerSockets). As part of this, significantly refactor how both classes handle the transport. BoringSSL's SSL stack expects the transport as a BIO. BIOs follow the UNIX-style non-blocking I/O. Our net stack, however, is based on asynchronous callbacks. Both socket had some complex code to bridge the two I/O models. Factor all this code into a SocketBIOAdapter. This takes a StreamSocket and returns a BIO which acts on the socket. The UNIX model assumes external knowledge of when to retry operations (usually a select loop), so the SocketBIOAdapter has a delegate interface which signals OnReadReady and OnWriteReady. By being factored out, it can also be independently unit-tested, which is handy. It also implements the weird hack we have where write errors route into read errors. In doing so, it fixes a case where whether that error was routed correctly depended on whether transport Writes failed synchronously (if BufferSend synchronously succeeded in DoWriteLoop, DoPayloadRead wasn't run, but it was run if asynchronous). This requires tweaking a test expectation. This removes uses of the bizarre "zero-copy" BIO pair stuff which can now be removed from BoringSSL. It also unifies client and server I/O handling which fixes transport error mapping on the server. (Accordingly, some server test expectations also needed fixes.) Oh, and on top of all this, actually drop the buffers when not needed as this was sort of the point of this exercise. Having the code factored out makes this a lot simpler to reason about and avoids adding even more complexity to BIO pairs. BUG=652456, 399455 Committed: https://crrev.com/3418e81ff9636db1d9e0de7c60e002788b51f5ea Cr-Commit-Position: refs/heads/master@{#426097}

Patch Set 1 #

Patch Set 2 : comments #

Patch Set 3 : fix net_nacl #

Patch Set 4 : rebase #

Patch Set 5 : Self-review #

Patch Set 6 : typo #

Total comments: 31

Patch Set 7 : rsleevi comments #

Total comments: 5

Patch Set 8 : mmenke comment #

Total comments: 4

Patch Set 9 : rsleevi comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1267 lines, -663 lines) Patch
M net/net.gypi View 1 2 3 4 5 6 7 2 chunks +3 lines, -0 lines 0 comments Download
A net/socket/socket_bio_adapter.h View 1 2 3 4 5 6 7 8 1 chunk +143 lines, -0 lines 0 comments Download
A net/socket/socket_bio_adapter.cc View 1 2 3 4 5 6 7 8 1 chunk +340 lines, -0 lines 0 comments Download
A net/socket/socket_bio_adapter_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +617 lines, -0 lines 0 comments Download
M net/socket/socket_test_util.h View 1 2 3 4 5 6 3 chunks +8 lines, -4 lines 0 comments Download
M net/socket/socket_test_util.cc View 1 2 3 4 5 6 7 2 chunks +16 lines, -5 lines 0 comments Download
M net/socket/ssl_client_socket_impl.h View 10 chunks +13 lines, -53 lines 0 comments Download
M net/socket/ssl_client_socket_impl.cc View 1 2 3 4 5 6 7 15 chunks +64 lines, -328 lines 0 comments Download
M net/socket/ssl_client_socket_unittest.cc View 2 chunks +10 lines, -13 lines 0 comments Download
M net/socket/ssl_server_socket_impl.cc View 1 2 3 4 5 6 7 13 chunks +43 lines, -256 lines 0 comments Download
M net/socket/ssl_server_socket_unittest.cc View 3 chunks +6 lines, -3 lines 0 comments Download
M net/ssl/openssl_ssl_util.h View 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 52 (37 generated)
davidben
svaldez + eroman: We probably want to have multiple sets of eyes on this one. ...
4 years, 2 months ago (2016-10-12 18:21:33 UTC) #19
davidben
Ryan tells me he exists again, so moving up to the reviewers list. Probably still ...
4 years, 2 months ago (2016-10-12 18:33:49 UTC) #21
eroman
Thanks for working on this David! I probably won't get to this until Friday, but ...
4 years, 2 months ago (2016-10-12 22:07:32 UTC) #28
Ryan Sleevi
Mostly LG, but some comments (mostly on comments) https://codereview.chromium.org/2411033003/diff/100001/net/socket/socket_bio_adapter.cc File net/socket/socket_bio_adapter.cc (right): https://codereview.chromium.org/2411033003/diff/100001/net/socket/socket_bio_adapter.cc#newcode73 net/socket/socket_bio_adapter.cc:73: // ...
4 years, 2 months ago (2016-10-12 23:30:27 UTC) #29
davidben
In fixing up an issue here, I noticed socket_test_util.cc didn't work. +mmenke to review those ...
4 years, 2 months ago (2016-10-13 23:40:13 UTC) #33
davidben
https://codereview.chromium.org/2411033003/diff/100001/net/socket/socket_bio_adapter.h File net/socket/socket_bio_adapter.h (right): https://codereview.chromium.org/2411033003/diff/100001/net/socket/socket_bio_adapter.h#newcode67 net/socket/socket_bio_adapter.h:67: static const BIO_METHOD kBIOMethod; On 2016/10/13 23:40:13, davidben wrote: ...
4 years, 2 months ago (2016-10-13 23:44:08 UTC) #34
mmenke
socket_test_util LGTM https://codereview.chromium.org/2411033003/diff/120001/net/socket/socket_test_util.cc File net/socket/socket_test_util.cc (right): https://codereview.chromium.org/2411033003/diff/120001/net/socket/socket_test_util.cc#newcode207 net/socket/socket_test_util.cc:207: } If this isn't being used, should ...
4 years, 2 months ago (2016-10-14 14:57:39 UTC) #37
davidben
https://codereview.chromium.org/2411033003/diff/120001/net/socket/socket_test_util.cc File net/socket/socket_test_util.cc (right): https://codereview.chromium.org/2411033003/diff/120001/net/socket/socket_test_util.cc#newcode207 net/socket/socket_test_util.cc:207: } On 2016/10/14 14:57:39, mmenke wrote: > If this ...
4 years, 2 months ago (2016-10-14 16:32:37 UTC) #38
mmenke
https://codereview.chromium.org/2411033003/diff/120001/net/socket/socket_test_util.cc File net/socket/socket_test_util.cc (right): https://codereview.chromium.org/2411033003/diff/120001/net/socket/socket_test_util.cc#newcode207 net/socket/socket_test_util.cc:207: } On 2016/10/14 16:32:37, davidben wrote: > On 2016/10/14 ...
4 years, 2 months ago (2016-10-14 16:45:32 UTC) #39
Ryan Sleevi
So, overall, this LGTM, but I have one concern with the approach, highlighted below, because ...
4 years, 2 months ago (2016-10-18 01:30:18 UTC) #40
davidben
https://codereview.chromium.org/2411033003/diff/140001/net/socket/socket_bio_adapter.cc File net/socket/socket_bio_adapter.cc (right): https://codereview.chromium.org/2411033003/diff/140001/net/socket/socket_bio_adapter.cc#newcode173 net/socket/socket_bio_adapter.cc:173: write_offset -= write_buffer_->capacity(); On 2016/10/18 01:30:17, Ryan Sleevi (at ...
4 years, 2 months ago (2016-10-18 20:49:11 UTC) #43
Ryan Sleevi
Thanks! LGTM
4 years, 2 months ago (2016-10-18 21:51:03 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2411033003/160001
4 years, 2 months ago (2016-10-18 22:07:56 UTC) #48
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 2 months ago (2016-10-19 00:10:52 UTC) #50
commit-bot: I haz the power
4 years, 2 months ago (2016-10-21 13:05:07 UTC) #52
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/3418e81ff9636db1d9e0de7c60e002788b51f5ea
Cr-Commit-Position: refs/heads/master@{#426097}

Powered by Google App Engine
This is Rietveld 408576698