Skip to content

8334670: SSLSocketOutputRecord buffer miscalculation #19862

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

Closed
wants to merge 3 commits into from

Conversation

ascarpino
Copy link
Contributor

@ascarpino ascarpino commented Jun 24, 2024

Hi,

I need a review to change the a fragment buffer size miscalculation error. This appears when there are large handshake messages and hasn't been observed during application data. This was found during testing of the NewSessionTicket change in JDK-8328608. There is no regression test as the failure hasn't shown to fail every time.

thanks

Tony


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

Issue

  • JDK-8334670: SSLSocketOutputRecord buffer miscalculation (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19862

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 24, 2024

👋 Welcome back ascarpino! 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 Jun 24, 2024

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

8334670: SSLSocketOutputRecord buffer miscalculation

Reviewed-by: djelinski, ssahoo

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

  • 25c3845: 8333133: Simplify QuickSort::sort
  • c66f785: 8334505: RISC-V: Several tests fail when MaxVectorSize does not match VM_Version::_initial_vector_length
  • f101e15: 8333583: Crypto-XDH.generateSecret regression after JDK-8329538
  • b3bf31a: 8333542: Breakpoint in parallel code does not work
  • 86b0cf2: 8334653: ISO 4217 Amendment 177 Update
  • 861aefc: 8334418: Update IANA Language Subtag Registry to Version 2024-06-14
  • f8bf470: 8334810: Redo: Un-ProblemList LocaleProvidersRun and CalendarDataRegression
  • 933eaba: 8334629: [BACKOUT] PhaseIdealLoop::conditional_move is too conservative
  • 7429c37: 8334598: Default classlist in JDK is not deterministic after JDK-8293980
  • 9c89f08: 8334421: assert(!oldbox->is_unbalanced()) failed: this should not be called for unbalanced region
  • ... and 126 more: https://git.openjdk.org/jdk/compare/301bd7085654328f941c462bc786e995051d1a9c...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 rfr Pull request is ready for review label Jun 24, 2024
@openjdk
Copy link

openjdk bot commented Jun 24, 2024

@ascarpino 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 Jun 24, 2024
@mlbridge
Copy link

mlbridge bot commented Jun 24, 2024

Webrevs

Copy link
Member

@djelinski djelinski left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing this!

In order to test this fix, we would need to trigger a situation where count != position, and it seems to be impossible, because we flush after every single message. We don't need to flush that often; I'll log a ticket for this.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 25, 2024
Copy link
Member

@djelinski djelinski left a comment

Choose a reason for hiding this comment

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

Actually, I think this line needs to be changed too.

@@ -169,7 +169,8 @@ void encodeHandshake(byte[] source,
for (int limit = (offset + length); offset < limit;) {

int remains = (limit - offset) + (count - position);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
int remains = (limit - offset) + (count - position);
int remains = (limit - offset);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this and it caused a lockup in one of the tests. I see why your think this is the right change, but it isn't proving out in the testing

Copy link
Member

Choose a reason for hiding this comment

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

That's very interesting! Which test was it? Was it with or without #19465?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do run the tests layered on the current #19465, even though this PR is separate.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jun 25, 2024
Copy link
Member

@sisahoo sisahoo left a comment

Choose a reason for hiding this comment

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

Hi @sisahoo, thanks for making a comment in an OpenJDK project!

All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user sisahoo" for the summary.

If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

Copy link
Member

@djelinski djelinski 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 making the change. LGTM.

Is it possible to add a Test?

I don't think it is possible; right now we flush after every handshake message. As a result, count == position every time we enter this loop, so the change doesn't really change anything. The problem only surfaced in #19465, and only when multiple NewSessionTicket messages exceeding 16KB were sent without flushing.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 26, 2024
@ascarpino
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 26, 2024

Going to push as commit 07bc523.
Since your change was applied there have been 153 commits pushed to the master branch:

  • 4ebb771: 8334769: Shenandoah: Move CodeCache_lock close to its use in ShenandoahConcurrentNMethodIterator
  • 817edcb: 8331411: Shenandoah: Reconsider spinning duration in ShenandoahLock
  • bffc848: 8333755: NumberFormat integer only parsing breaks when format has suffix
  • b5d5896: 8335108: Build error after JDK-8333658 due to class templates
  • 5883a20: 8334437: De-duplicate ProxyMethod list creation
  • 8591eff: 8332103: since-checker - Add missing @ since tags to java.desktop
  • 8374d16: 8335006: C2 SuperWord: add JMH benchmark VectorLoadToStoreForwarding.java
  • 4ffc5e6: 8326705: Test CertMsgCheck.java fails to find alert certificate_required
  • efb905e: 8334618: ubsan: support setting additional ubsan check options
  • b2ac725: 8327380: Add tests for Shenandoah barrier expansion optimization
  • ... and 143 more: https://git.openjdk.org/jdk/compare/301bd7085654328f941c462bc786e995051d1a9c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 26, 2024
@openjdk openjdk bot closed this Jun 26, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 26, 2024
@openjdk
Copy link

openjdk bot commented Jun 26, 2024

@ascarpino Pushed as commit 07bc523.

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

@ascarpino ascarpino deleted the fragLimit branch February 14, 2025 21:15
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.

3 participants