Skip to content

Commit

Permalink
[io/ssl] Avoid reinitiating racing handshake request.
Browse files Browse the repository at this point in the history
When other side closes their write socket during us running handhsake, don't repeat handshake. Repeated handshake call results in boringssl secure filter data race between ongoing encryption/decryption sequence and this new handshake call, running concurrently.

Fixes #53136
TEST=secure_session_resume_test on TSAN
CoreLibraryReviewExempt:no user-visible changes to io functionality
Change-Id: I7540b41b15b3a7487a237b6957314e38b078a774
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366401
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
  • Loading branch information
aam authored and Commit Queue committed May 14, 2024
1 parent 595fcd6 commit 480e631
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/lib/io/secure_socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -905,12 +905,12 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
}
} else if (_status == handshakeStatus) {
_socketClosedRead = true;
// The other party might have disconnected, but if there still
// bytes available we can continue handshake.
if (_filterStatus.readEmpty) {
_reportError(
new HandshakeException('Connection terminated during handshake'),
null);
} else {
await _secureHandshake();
}
}
}
Expand Down

0 comments on commit 480e631

Please sign in to comment.