Detect EOF while reading in libssl (master)#10907
Closed
mattcaswell wants to merge 2 commits intoopenssl:masterfrom
Closed
Detect EOF while reading in libssl (master)#10907mattcaswell wants to merge 2 commits intoopenssl:masterfrom
mattcaswell wants to merge 2 commits intoopenssl:masterfrom
Conversation
If we hit an EOF while reading in libssl then we will report an error back to the application (SSL_ERROR_SYSCALL) but errno will be 0. We add an error to the stack (which means we instead return SSL_ERROR_SSL) and therefore give a hint as to what went wrong. Contains a partial fix for openssl#10880
Member
|
Are there any other bss_ files that should be handling BIO_FLAGS_IN_EOF? |
Member
Author
I added an additional commit to teach more BIOs how to respond to BIO_CTRL_EOF |
Member
Author
|
Ping |
beldmit
approved these changes
Feb 3, 2020
openssl-machine
pushed a commit
that referenced
this pull request
Feb 4, 2020
If we hit an EOF while reading in libssl then we will report an error back to the application (SSL_ERROR_SYSCALL) but errno will be 0. We add an error to the stack (which means we instead return SSL_ERROR_SSL) and therefore give a hint as to what went wrong. Contains a partial fix for #10880 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from #10907)
openssl-machine
pushed a commit
that referenced
this pull request
Feb 4, 2020
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from #10907)
Member
Author
|
Pushed. Thanks. |
Contributor
|
So I now get the new error even without pressing Ctrl-C in openssl s_client. That is, a normal s_client request that should end normally now fails with the error when previously with 1.1.1 it didn't report an error: OpenSSL 1.1.1d-freebsd 10 Sep 2019: This is what I get with 'master' after this commit: |
Contributor
|
I'm getting the same new error on 1.1.1e since this commit was merged there. |
This file contains hidden or 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
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.
If we hit an EOF while reading in libssl then we will report an error
back to the application (SSL_ERROR_SYSCALL) but errno will be 0. We add
an error to the stack (which means we instead return SSL_ERROR_SSL) and
therefore give a hint as to what went wrong.
Contains a partial fix for #10880
This is the master version of #10882. I've left #10882 in WIP for now, but this one is ready for review.
I have a feeling that we are likely to see a number of reports as a result of this change going in. It turns out to be rather easy to hit the new "unexpected eof while reading" error that this change introduces.
For example if you start s_server:
And then start s_client:
Simply pressing ctrl-C on the s_server side results in this error on the s_client side:
Previously we got this rather enigmatic and unhelpful message:
Similarly doing it the other way around (pressing ctrl-c on the s_client side) we see the same "unexpected eof while reading" displayed by s_server. Previously it just said "ERROR" with no additional information.
I think this is an improvement and more accurately helps people to diagnose the problem. However I suspect that lots of people encounter this at the moment and it is logged one way in their logs - and this change will give a different error message - which may be a surprise to lots of people.
With all of that in mind we should consider whether we want to backport this to 1.1.1, or whether this bug fix is a step too far there.