Fix ssl_free() and thus BIO_free() to respect BIO_NOCLOSE#16688
Fix ssl_free() and thus BIO_free() to respect BIO_NOCLOSE#16688DDvO wants to merge 3 commits intoopenssl:masterfrom
Conversation
t8m
left a comment
There was a problem hiding this comment.
The CI failure - leaks - is relevant.
Sigh, yes. So this old bug hid further issues. |
bd68f2e to
f8eb0f1
Compare
|
I meanwhile analyzed the situation and found and fixed further issues, It turns out that the |
|
I think the severity: fips change label, which got (re-)added automatically here, is meanwhile a false positive: |
|
This still changes public API - the macro is part of it. It is slightly better but I am not sure this should be merged. Would there be any way to fix without changing public headers? |
|
I've meanwhile moved the call of |
I think this is the wrong thing to do. Further comments as review comments. |
ea97f2b to
3d8fb5c
Compare
|
Can I add the branch 3.0 tag here? |
t8m
left a comment
There was a problem hiding this comment.
LGTM. IMO this is a clear bug fix so definitely applicable to 3.0.
|
Of course the s_socket.c change is applicable only to master but that commit can be just skipped when cherry picking. |
kaduk
left a comment
There was a problem hiding this comment.
While it does look on the face of it like this is a clear bugfix and thus candidate for backport, I worry that it might fall into the category of bugs that are so longstanding that everything that cares has worked around the bug already, so that fixing the bug is more disruptive than leaving it in.
I do not really see a scenario where this fix could break anyone. Would you please elaborate? |
|
I do not see how anyone would accidentally set BIO_NOCLOSE and expect that the SSL_shutdown() is done anyway. You would have to explicitly set the BIO_NOCLOSE but why would you do that if that does not have any real effect with the current code? |
|
24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually. |
I don't have a specific scenario in mind, this just qualitatively feels like some other cases where we've fixed a clear bug and then had it cause problems in practice due to software that had worked around it already. Purely hypothetical, but consider an application using a common framework to manage multiple BIO types that just always set BIO_NOCLOSE unconditionally on all BIOs. That gets the precondition that the flag is set, and the framework then adds a workaround to match the observed behavior for SSL BIOs. Is that a plausible scenario? I don't know. But it's enough to make me ask the question of whether the bugfix could be disruptive. |
|
I do not really see how this could be a plausible scenario. |
Reviewed-by: Tomas Mraz <[email protected]> (Merged from #16688)
Reviewed-by: Tomas Mraz <[email protected]> (Merged from #16688)
Reviewed-by: Tomas Mraz <[email protected]> (Merged from #16688)
Reviewed-by: Tomas Mraz <[email protected]> (Merged from #16688) (cherry picked from commit dce910a)
Reviewed-by: Tomas Mraz <[email protected]> (Merged from #16688) (cherry picked from commit 34901b0)
|
Merged to master and 3.0 (only the two applicable commits). Thank you. |
I also thought that it might be problematic to fix this longstanding bug because existing software may rely in the buggy behavior. Yet at least none of our tests broke. |
Thanks @t8m for handling the discussion on between and merging this to both branches. |
Reviewed-by: Tomas Mraz <[email protected]> (Merged from openssl#16688)
Reviewed-by: Tomas Mraz <[email protected]> (Merged from openssl#16688)
|
I just realized that most of #16688, namely
pertains to earlier OpenSSL versions as well. |
|
Please create a separate PR against 1.1.1 I suppose this one won't cherry pick cleanly. |
|
Good point; done in #17135. |
I recently integrated the CMP client (alternatively to EST) in a BRSKI implementation in a way that an existing TLS connection is reused for the HTTP(S) transfer of CMP messages.
To this end, I embedded the SSL connection represented by the variable
SSL *sslas follows:After the CMP exchange is done, I call
BIO_free(sbio)Yet after doing so, the
sslconnection is not more usable for a further BRSKI message exchange,and it turns out this is because
ssl_free()and thusBIO_free()does not respectBIO_NOCLOSE.(BTW, looking at the overall code base,
BIO_NOCLOSEseems to have little influence also on other BIOs).The present PR fixes this bug.