Skip to content
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

8282600: SSLSocketImpl should not use user_canceled workaround when not necessary #7664

Closed
wants to merge 1 commit into from

Conversation

zzambers
Copy link
Contributor

@zzambers zzambers commented Mar 2, 2022

When testing compatibility of jdk TLS implementation with gnutls, I have found a problem. The problem is, that gnutls does not like use of user_canceled alert when closing TLS-1.3 connection from duplexCloseOutput() (used by socket.close() unless shutdownOutput was called explicitly) and considers it error. (For more details see: [1])

As I understand it, usage of user_canceled alert before close is workaround for an issue of not being able to cleanly initialize full (duplex) close of TLS-1.3 connection (other side is not required to immediately close the after receiving close_notify, unlike in earlier TLS versions). Some legacy programs could probably hang or something, expecting socket.close to perform immediate duplex close. Problem is this is not what user_canceled alert is intended for [2] and it is therefore undefined how the other side handles this. (JDK itself replies to close_notify preceded by user_canceled alert by immediately closing its output [3].)

This fix disables this workaround when it is not necessary (connection is already half-closed by the other side). This way it fixes my case (gnutls client connected to jdk server initiates close) and it should be safe. (As removing workaround altogether could probably reintroduce issues for legacy apps... )

I also ran jdk_security tests locally, which passed for me.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1918473
[2] https://datatracker.ietf.org/doc/html/rfc8446#section-6.1
[3]

if (alert == Alert.CLOSE_NOTIFY) {


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 reviews required, with at least 1 reviewer)

Issue

  • JDK-8282600: SSLSocketImpl should not use user_canceled workaround when not necessary

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7664/head:pull/7664
$ git checkout pull/7664

Update a local copy of the PR:
$ git checkout pull/7664
$ git pull https://git.openjdk.java.net/jdk pull/7664/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7664

View PR using the GUI difftool:
$ git pr show -t 7664

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7664.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 2, 2022

👋 Welcome back zzambers! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Mar 2, 2022

@zzambers The following label will be automatically applied to this pull request:

  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the security security-dev@openjdk.org label Mar 2, 2022
@jerboaa
Copy link
Contributor

jerboaa commented Mar 3, 2022

@zzambers I've create https://bugs.openjdk.java.net/browse/JDK-8282600 for this issue. Please reference it in the PR title.

@zzambers zzambers changed the title SSLSocketImpl should not use user_canceled workaround when not necessary 8282600: SSLSocketImpl should not use user_canceled workaround when not necessary Mar 3, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 3, 2022
@mlbridge
Copy link

mlbridge bot commented Mar 3, 2022

Webrevs

@zzambers
Copy link
Contributor Author

zzambers commented Mar 3, 2022

@jerboaa thank you

Copy link
Member

@XueleiFan XueleiFan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a nice change to me. Thank you!

@openjdk
Copy link

openjdk bot commented Mar 3, 2022

@zzambers This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8282600: SSLSocketImpl should not use user_canceled workaround when not necessary

Reviewed-by: xuelei, wetmore

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 760 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@XueleiFan, @bradfordwetmore) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 3, 2022
@XueleiFan
Copy link
Member

Did you want to add a test? Otherwise, please add a noreg- label in the bug JDK-8282600.

@zzambers
Copy link
Contributor Author

zzambers commented Mar 3, 2022

@XueleiFan thank you for review. I have added noreg-external tag and some explanation to Openjdk bug.

@bradfordwetmore
Copy link
Contributor

bradfordwetmore commented Mar 9, 2022

I am looking at a few things in this PR. Please ping me before integrating.

I believe this code is correct, but checking on the overall USER_CANCELED strategy.

@zzambers
Copy link
Contributor Author

@bradfordwetmore, it is ready from my side, but please take your time to do any checks, which you find necessary to make sure there is no problem here.

@bradfordwetmore
Copy link
Contributor

Thanks, been working on another close issue. I should be finishing that shortly,

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 11, 2022

@zzambers This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bradfordwetmore
Copy link
Contributor

Resettting the clock. Sorry for the delay.

Copy link
Contributor

@bradfordwetmore bradfordwetmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extra time to review this change.

I'm still wondering if there is better pattern that doesn't use user_canceled, but that doesn't need to delay this fix from going in.

@bradfordwetmore
Copy link
Contributor

tier1/tier2 tests pass. Did not try infra or JCK yet.

@bradfordwetmore
Copy link
Contributor

Infra + JCK passed. Looks good.

@zzambers
Copy link
Contributor Author

zzambers commented May 5, 2022

@bradfordwetmore Thank you

@zzambers
Copy link
Contributor Author

zzambers commented May 5, 2022

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label May 5, 2022
@openjdk
Copy link

openjdk bot commented May 5, 2022

@zzambers
Your change (at version f16499b) is now ready to be sponsored by a Committer.

@jerboaa
Copy link
Contributor

jerboaa commented May 5, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented May 5, 2022

Going to push as commit 7e88ff8.
Since your change was applied there have been 760 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 5, 2022
@openjdk openjdk bot closed this May 5, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels May 5, 2022
@openjdk
Copy link

openjdk bot commented May 5, 2022

@jerboaa @zzambers Pushed as commit 7e88ff8.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants