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

Issue 2453113002: Fix object-lifetime issues in async GetProof callpaths (Closed)

Created:
4 years, 1 month ago by Buck
Modified:
4 years, 1 month ago
Reviewers:
Ryan Hamilton
CC:
chromium-reviews, cbentzel+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix object-lifetime issues in async GetProof callpaths This CL addresses two categories of object-lifetime issues that were uncovered during Mentat testing. The first problem is that the lifetime of Stream objects is decoupled from the some async operations which call through Stream code, leading to use-after-free crashes if the Stream is destroyed while an async operation is in progress. The second problem is that the async GetProof operations assume that some some subobjects of the Stream will continue to exist until the async operation completes - which is violated if the Stream is destroyed early. The solution is twofold: first, the Stream's callback object needs cancellation support wired into the Stream, so that the Stream's destructor will disarm the callback from calling back into the Stream when it completes. Second, the subobjects of the Stream which need to live until the async operation completes are converted to use refcounted ownership semantics, so that the async operation can extend their lifetime. This behavior is tested in a whitebox manner by setting up a situation in which a Stream calls into the async GetProof and the test destroys the Stream before that async operation is allowed to complete. Under asan, this reliably reproduces the problem. I have also tested this CL "in the wild" on a GFE experiment machine serving real traffic. Fix memory-lifetime issues in QuicCryptoServerStream. The problems as well as the fix are protected by a number of existing flags, primarily FLAGS_enable_async_get_proof Merge internal change: 136609079 R=rch@chromium.org BUG=

Patch Set 1 #

Patch Set 2 : rebase-update #

Patch Set 3 : Updated patchset dependency #

Unified diffs Side-by-side diffs Delta from patch set Stats (+319 lines, -179 lines) Patch
M net/quic/core/crypto/crypto_handshake.h View 1 2 chunks +6 lines, -2 lines 0 comments Download
M net/quic/core/crypto/crypto_server_test.cc View 1 8 chunks +13 lines, -11 lines 0 comments Download
M net/quic/core/crypto/quic_crypto_client_config.h View 5 chunks +37 lines, -33 lines 0 comments Download
M net/quic/core/crypto/quic_crypto_client_config.cc View 5 chunks +5 lines, -5 lines 0 comments Download
M net/quic/core/crypto/quic_crypto_client_config_test.cc View 11 chunks +30 lines, -20 lines 0 comments Download
M net/quic/core/crypto/quic_crypto_server_config.h View 1 8 chunks +14 lines, -10 lines 0 comments Download
M net/quic/core/crypto/quic_crypto_server_config.cc View 1 11 chunks +15 lines, -14 lines 0 comments Download
M net/quic/core/quic_crypto_client_stream.cc View 8 chunks +11 lines, -11 lines 0 comments Download
M net/quic/core/quic_crypto_server_stream.h View 2 chunks +6 lines, -1 line 0 comments Download
M net/quic/core/quic_crypto_server_stream.cc View 1 12 chunks +54 lines, -34 lines 0 comments Download
M net/quic/core/quic_crypto_stream.h View 2 chunks +3 lines, -1 line 0 comments Download
M net/quic/core/quic_crypto_stream.cc View 3 chunks +8 lines, -4 lines 0 comments Download
M net/quic/core/quic_server_session_base_test.cc View 1 4 chunks +79 lines, -2 lines 0 comments Download
M net/quic/test_tools/crypto_test_utils.h View 1 chunk +1 line, -1 line 0 comments Download
M net/quic/test_tools/crypto_test_utils.cc View 5 chunks +7 lines, -6 lines 0 comments Download
M net/quic/test_tools/crypto_test_utils_test.cc View 5 chunks +10 lines, -9 lines 0 comments Download
M net/quic/test_tools/mock_crypto_client_stream.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M net/tools/quic/quic_dispatcher_test.cc View 6 chunks +9 lines, -6 lines 0 comments Download
M net/tools/quic/stateless_rejector.h View 1 chunk +2 lines, -2 lines 0 comments Download
M net/tools/quic/stateless_rejector.cc View 3 chunks +5 lines, -3 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 10 (8 generated)
Buck
4 years, 1 month ago (2016-10-26 21:06:23 UTC) #1
Ryan Hamilton
4 years, 1 month ago (2016-10-26 21:55:41 UTC) #10
LGTM, though it looks like you might need to rebase from all the red bots.

Powered by Google App Engine
This is Rietveld 408576698