-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SslHandler LocalChannel read/unwrap reentry fix #11156
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scottmitch
requested review from
chrisvest,
rkapsi,
normanmaurer and
idelpivnitskiy
April 14, 2021 00:52
Scottmitch
force-pushed
the
ssl_handler_read_reentry
branch
2 times, most recently
from
April 14, 2021 05:45
0a42ec8
to
a362de5
Compare
Scottmitch
force-pushed
the
ssl_handler_read_reentry
branch
from
April 14, 2021 08:04
a37416c
to
3290799
Compare
@Scottmitch tested and fixes #11146. All our Unit Tests pass. |
Scottmitch
force-pushed
the
ssl_handler_read_reentry
branch
from
April 14, 2021 21:08
b3dd91e
to
b340d44
Compare
the state consolidation was moved into #11160, and this PR has been rebased |
Scottmitch
force-pushed
the
ssl_handler_read_reentry
branch
from
April 15, 2021 00:34
b340d44
to
eb484b6
Compare
Motivation: SslHandler invokes channel.read() during the handshake process. For some channel implementations (e.g. LocalChannel) this may result in re-entry conditions into unwrap. Unwrap currently defers updating the input buffer indexes until the unwrap method returns to avoid intermediate updates if not necessary, but this may result in unwrapping the same contents multiple times which leads to handshake failures [1][2]. [1] ssl3_get_record:decryption failed or bad record mac [2] ssl3_read_bytes:sslv3 alert bad record mac Modifications: - SslHandler#unwrap updates buffer indexes on each iteration so that if reentry scenario happens the correct indexes will be visible. Result: Fixes netty#11146
Scottmitch
force-pushed
the
ssl_handler_read_reentry
branch
from
April 15, 2021 15:19
eb484b6
to
d02fe40
Compare
chrisvest
approved these changes
Apr 15, 2021
@rkapsi - would you mind re-checking this PR resolves your issues? it has been rebased and there are some additional changes made since your first verified. |
@Scottmitch re-tested; still works and all tests pass. |
Scottmitch
added a commit
that referenced
this pull request
Apr 16, 2021
Motivation: SslHandler invokes channel.read() during the handshake process. For some channel implementations (e.g. LocalChannel) this may result in re-entry conditions into unwrap. Unwrap currently defers updating the input buffer indexes until the unwrap method returns to avoid intermediate updates if not necessary, but this may result in unwrapping the same contents multiple times which leads to handshake failures [1][2]. [1] ssl3_get_record:decryption failed or bad record mac [2] ssl3_read_bytes:sslv3 alert bad record mac Modifications: - SslHandler#unwrap updates buffer indexes on each iteration so that if reentry scenario happens the correct indexes will be visible. Result: Fixes #11146
master (59867fa) |
raidyue
pushed a commit
to raidyue/netty
that referenced
this pull request
Jul 8, 2022
Motivation: SslHandler invokes channel.read() during the handshake process. For some channel implementations (e.g. LocalChannel) this may result in re-entry conditions into unwrap. Unwrap currently defers updating the input buffer indexes until the unwrap method returns to avoid intermediate updates if not necessary, but this may result in unwrapping the same contents multiple times which leads to handshake failures [1][2]. [1] ssl3_get_record:decryption failed or bad record mac [2] ssl3_read_bytes:sslv3 alert bad record mac Modifications: - SslHandler#unwrap updates buffer indexes on each iteration so that if reentry scenario happens the correct indexes will be visible. Result: Fixes netty#11146
raidyue
pushed a commit
to raidyue/netty
that referenced
this pull request
Jul 8, 2022
…ion for a handshake success (netty#11203) Motivation: netty#11210 fixed a regression caused by netty#11156. This change adds a unit test for it. Modifications: - Add test Result: Verify fix in netty#11210 Co-authored-by: Norman Maurer <norman_maurer@apple.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
SslHandler invokes channel.read() during the handshake process. For some
channel implementations (e.g. LocalChannel) this may result in re-entry
conditions into unwrap. Unwrap currently defers updating the input
buffer indexes until the unwrap method returns to avoid intermediate
updates if not necessary, but this may result in unwrapping the same
contents multiple times which leads to handshake failures [1][2].
[1] ssl3_get_record:decryption failed or bad record mac
[2] ssl3_read_bytes:sslv3 alert bad record mac
Modifications:
reentry scenario happens the correct indexes will be visible.
Result:
Fixes #11146