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

Side by Side Diff: net/quic/chromium/quic_stream_factory.cc

Issue 2277953002: Fixes use-after-free with Server Migration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Reproduced bug in test and fixed. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/chromium/quic_stream_factory.h ('k') | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <openssl/aead.h> 7 #include <openssl/aead.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <tuple> 10 #include <tuple>
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 // Track sessions which have recently gone away so that we can disable 1255 // Track sessions which have recently gone away so that we can disable
1256 // port suggestions. 1256 // port suggestions.
1257 if (session->goaway_received()) 1257 if (session->goaway_received())
1258 gone_away_aliases_.insert(*it); 1258 gone_away_aliases_.insert(*it);
1259 1259
1260 active_sessions_.erase(server_id); 1260 active_sessions_.erase(server_id);
1261 ProcessGoingAwaySession(session, server_id, true); 1261 ProcessGoingAwaySession(session, server_id, true);
1262 } 1262 }
1263 ProcessGoingAwaySession(session, all_sessions_[session].server_id(), false); 1263 ProcessGoingAwaySession(session, all_sessions_[session].server_id(), false);
1264 if (!aliases.empty()) { 1264 if (!aliases.empty()) {
1265 const IPEndPoint peer_address = session->connection()->peer_address(); 1265 DCHECK(base::ContainsKey(session_peer_ip_, session));
1266 const IPEndPoint peer_address = session_peer_ip_[session];
1266 ip_aliases_[peer_address].erase(session); 1267 ip_aliases_[peer_address].erase(session);
1267 if (ip_aliases_[peer_address].empty()) 1268 if (ip_aliases_[peer_address].empty())
1268 ip_aliases_.erase(peer_address); 1269 ip_aliases_.erase(peer_address);
1270 session_peer_ip_.erase(session);
1271 DVLOG(1) << "Deleted from ip_aliases_ map: "
1272 << peer_address.address().ToString();
Ryan Hamilton 2016/08/25 19:29:59 nit: I think you can remove this logging since I d
Jana 2016/08/25 21:41:26 Meh. I wasn't sure, but I thought it might be usef
1269 } 1273 }
1270 session_aliases_.erase(session); 1274 session_aliases_.erase(session);
1271 } 1275 }
1272 1276
1273 void QuicStreamFactory::MaybeDisableQuic(QuicChromiumClientSession* session) { 1277 void QuicStreamFactory::MaybeDisableQuic(QuicChromiumClientSession* session) {
1274 DCHECK(session); 1278 DCHECK(session);
1275 uint16_t port = session->server_id().port(); 1279 uint16_t port = session->server_id().port();
1276 if (IsQuicDisabled(port)) 1280 if (IsQuicDisabled(port))
1277 return; 1281 return;
1278 1282
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 void QuicStreamFactory::ActivateSession(const QuicSessionKey& key, 1874 void QuicStreamFactory::ActivateSession(const QuicSessionKey& key,
1871 QuicChromiumClientSession* session) { 1875 QuicChromiumClientSession* session) {
1872 const QuicServerId& server_id(key.server_id()); 1876 const QuicServerId& server_id(key.server_id());
1873 DCHECK(!HasActiveSession(server_id)); 1877 DCHECK(!HasActiveSession(server_id));
1874 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size()); 1878 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size());
1875 active_sessions_[server_id] = session; 1879 active_sessions_[server_id] = session;
1876 session_aliases_[session].insert(key); 1880 session_aliases_[session].insert(key);
1877 const IPEndPoint peer_address = session->connection()->peer_address(); 1881 const IPEndPoint peer_address = session->connection()->peer_address();
1878 DCHECK(!base::ContainsKey(ip_aliases_[peer_address], session)); 1882 DCHECK(!base::ContainsKey(ip_aliases_[peer_address], session));
1879 ip_aliases_[peer_address].insert(session); 1883 ip_aliases_[peer_address].insert(session);
1884 DCHECK(!base::ContainsKey(session_peer_ip_, session));
1885 session_peer_ip_[session] = peer_address;
1880 } 1886 }
1881 1887
1882 int64_t QuicStreamFactory::GetServerNetworkStatsSmoothedRttInMicroseconds( 1888 int64_t QuicStreamFactory::GetServerNetworkStatsSmoothedRttInMicroseconds(
1883 const QuicServerId& server_id) const { 1889 const QuicServerId& server_id) const {
1884 url::SchemeHostPort server("https", server_id.host_port_pair().host(), 1890 url::SchemeHostPort server("https", server_id.host_port_pair().host(),
1885 server_id.host_port_pair().port()); 1891 server_id.host_port_pair().port());
1886 const ServerNetworkStats* stats = 1892 const ServerNetworkStats* stats =
1887 http_server_properties_->GetServerNetworkStats(server); 1893 http_server_properties_->GetServerNetworkStats(server);
1888 if (stats == nullptr) 1894 if (stats == nullptr)
1889 return 0; 1895 return 0;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 // Since the session was active, there's no longer an 2048 // Since the session was active, there's no longer an
2043 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 2049 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
2044 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 2050 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
2045 // it as recently broken, which means that 0-RTT will be disabled but we'll 2051 // it as recently broken, which means that 0-RTT will be disabled but we'll
2046 // still race. 2052 // still race.
2047 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 2053 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
2048 alternative_service); 2054 alternative_service);
2049 } 2055 }
2050 2056
2051 } // namespace net 2057 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_stream_factory.h ('k') | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698