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

8227651: Tests fail with SSLProtocolException: Input record too big #9773

Closed
wants to merge 1 commit into from

Conversation

djelinski
Copy link
Member

@djelinski djelinski commented Aug 5, 2022

Fix SSLEngineService test class to make sure it does not discard any network data between handshaking and receive.

With TLS1.3 the client starts sending application data immediately after sending the Finished message. The server may read some of that data in the handshaking method. This patch makes sure that any such data is delivered to the receive method for processing.


Progress

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

Issues

  • JDK-8227651: Tests fail with SSLProtocolException: Input record too big
  • JDK-8212096: javax/net/ssl/ServerName/SSLEngineExplorerMatchedSNI.java failed intermittently due to SSLException: Tag mismatch

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9773/head:pull/9773
$ git checkout pull/9773

Update a local copy of the PR:
$ git checkout pull/9773
$ git pull https://git.openjdk.org/jdk pull/9773/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9773

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9773.diff

@djelinski
Copy link
Member Author

djelinski commented Aug 5, 2022

/issue add 8212096

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 5, 2022

👋 Welcome back djelinski! 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 openjdk bot changed the title 8227651 8227651: Tests fail with SSLProtocolException: Input record too big Aug 5, 2022
@openjdk
Copy link

openjdk bot commented Aug 5, 2022

@djelinski
Adding additional issue to issue list: 8212096: javax/net/ssl/ServerName/SSLEngineExplorerMatchedSNI.java failed intermittently due to SSLException: Tag mismatch.

@openjdk
Copy link

openjdk bot commented Aug 5, 2022

@djelinski 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 Aug 5, 2022
@djelinski djelinski marked this pull request as ready for review August 5, 2022 12:40
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 5, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 5, 2022

Webrevs

Copy link
Contributor

@coffeys coffeys left a comment

Choose a reason for hiding this comment

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

Nice work!

@openjdk
Copy link

openjdk bot commented Aug 10, 2022

@djelinski 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:

8227651: Tests fail with SSLProtocolException: Input record too big
8212096: javax/net/ssl/ServerName/SSLEngineExplorerMatchedSNI.java failed intermittently due to SSLException: Tag mismatch

Reviewed-by: coffeys, xuelei

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 72 new commits pushed to the master branch:

  • 9825c33: 8291641: Optimize StackTraceElement.toString()
  • cb37282: 8291752: AArch64: Remove check_emit_size parameter from trampoline_call
  • 37d3146: 8289002: Minimal x86_64 VM build fails with GCC 11: 'this' pointer is null
  • ecfa38f: 8281966: Absolute path of symlink is null in JFileChooser
  • 83dc2e3: 8292062: misc javax/swing tests failing
  • 4913380: 8292007: Do not include vmSymbol.hpp in method.hpp
  • 6397d56: 8151430: (fs) BasicFileAttributeView.setTimes should support setting file create time on OS X
  • 57e0da1: 8292132: ProblemList jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java
  • 17c77b5: 8292119: ProblemList java/awt/image/multiresolution/MultiresolutionIconTest.java on linux-x64 and windows-all
  • d889264: 8290836: Improve test coverage for XPath functions: String Functions
  • ... and 62 more: https://git.openjdk.org/jdk/compare/349397318687fdb7be8f50f02b536e49bffdd92f...master

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

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

Could it be a TLS implementation problem that the server should not read application data as handshaking data?

@djelinski
Copy link
Member Author

Could it be a TLS implementation problem that the server should not read application data as handshaking data?

Not really; SSLEngine#unwrap does not have to consume the entire ByteBuffer, and it's the application's responsibility to preserve unconsumed data for subsequent unwrap calls in case of buffer underflow/overflow.

There are 2 problems with the existing implementation:

  • unwrap in handshaking can consume (and discard) application data because peerAppData has nonzero size (does not happen in practice)
  • handshaking can lose unconsumed peerNetData

Both are fixed here.

@XueleiFan
Copy link
Member

Could it be a TLS implementation problem that the server should not read application data as handshaking data?

Not really; SSLEngine#unwrap does not have to consume the entire ByteBuffer, and it's the application's responsibility to preserve unconsumed data for subsequent unwrap calls in case of buffer underflow/overflow.

There are 2 problems with the existing implementation:

  • unwrap in handshaking can consume (and discard) application data because peerAppData has nonzero size (does not happen in practice)
  • handshaking can lose unconsumed peerNetData

Both are fixed here.

Thank you for the details.

@djelinski
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 10, 2022

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

  • 35fd5d8: 8292200: Add java/io/File/GetXSpace.java to Windows problem list
  • 9825c33: 8291641: Optimize StackTraceElement.toString()
  • cb37282: 8291752: AArch64: Remove check_emit_size parameter from trampoline_call
  • 37d3146: 8289002: Minimal x86_64 VM build fails with GCC 11: 'this' pointer is null
  • ecfa38f: 8281966: Absolute path of symlink is null in JFileChooser
  • 83dc2e3: 8292062: misc javax/swing tests failing
  • 4913380: 8292007: Do not include vmSymbol.hpp in method.hpp
  • 6397d56: 8151430: (fs) BasicFileAttributeView.setTimes should support setting file create time on OS X
  • 57e0da1: 8292132: ProblemList jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java
  • 17c77b5: 8292119: ProblemList java/awt/image/multiresolution/MultiresolutionIconTest.java on linux-x64 and windows-all
  • ... and 63 more: https://git.openjdk.org/jdk/compare/349397318687fdb7be8f50f02b536e49bffdd92f...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 10, 2022
@openjdk openjdk bot closed this Aug 10, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Aug 10, 2022
@djelinski djelinski deleted the sslengineservice-race branch August 10, 2022 18:16
@openjdk
Copy link

openjdk bot commented Aug 10, 2022

@djelinski Pushed as commit 7b029ea.

💡 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
3 participants