Skip to content

8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking#3096

Open
chadrako wants to merge 1 commit into
openjdk:masterfrom
chadrako:JDK-8277444
Open

8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking#3096
chadrako wants to merge 1 commit into
openjdk:masterfrom
chadrako:JDK-8277444

Conversation

@chadrako

@chadrako chadrako commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

Backport of https://bugs.openjdk.org/browse/JDK-8277444. The backport was not clean but the fixes were trivial naming differences

This fixes a race condition that occurs when a class is simultaneously retransformed via the Instrumentation API and linked. This can lead to invalid bytecode which will cause a VerifyError. Even worse, if class verifying is turned off, which it is by default for java.* classes, this will cause the JVM to crash/segfault.

The included test test/jdk/java/lang/instrument/RetransformBigClassTest.java fails before the patch and passes after



Progress

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

Issue

  • JDK-8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking (Bug - P4 - Requested)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/3096/head:pull/3096
$ git checkout pull/3096

Update a local copy of the PR:
$ git checkout pull/3096
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/3096/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3096

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/3096.diff

Using Webrev

Link to Webrev Comment

@chadrako

Copy link
Copy Markdown
Contributor Author

Waiting to request maintainer approval until backport is merged in newer JDKs

@bridgekeeper

bridgekeeper Bot commented Sep 18, 2025

Copy link
Copy Markdown

👋 Welcome back chadrako! 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 commented Sep 18, 2025

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot changed the title Backport 46ae1ee87152742082e6047d0556944d7ae4567d 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking Sep 18, 2025
@openjdk

openjdk Bot commented Sep 18, 2025

Copy link
Copy Markdown

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk Bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Sep 18, 2025
@mlbridge

mlbridge Bot commented Sep 18, 2025

Copy link
Copy Markdown

Webrevs

@bridgekeeper

bridgekeeper Bot commented Oct 17, 2025

Copy link
Copy Markdown

@chadrako 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 issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@chadrako

Copy link
Copy Markdown
Contributor Author

/keepalive

@openjdk

openjdk Bot commented Oct 20, 2025

Copy link
Copy Markdown

@chadrako The pull request is being re-evaluated and the inactivity timeout has been reset.

@bridgekeeper

bridgekeeper Bot commented Nov 18, 2025

Copy link
Copy Markdown

@chadrako 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 issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper

bridgekeeper Bot commented Dec 16, 2025

Copy link
Copy Markdown

@chadrako This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper Bot closed this Dec 16, 2025
@chadrako

Copy link
Copy Markdown
Contributor Author

/open

@openjdk openjdk Bot reopened this Mar 12, 2026
@openjdk

openjdk Bot commented Mar 12, 2026

Copy link
Copy Markdown

@chadrako This pull request is now open

@chadrako

Copy link
Copy Markdown
Contributor Author

/approval request An almost clean backport (trivial naming differences) that fixes a race condition that occurs when a class is simultaneously retransformed via the Instrumentation API and linked. This can lead to invalid bytecode which will cause a VerifyError. Even worse, if class verifying is turned off, which it is by default for java.* classes, this will cause the JVM to crash/segfault. The included test test/jdk/java/lang/instrument/RetransformBigClassTest.java fails before the patch and passes after. This patch has been in jdk25 and Corretto 11 for 6 months.

@openjdk

openjdk Bot commented Mar 12, 2026

Copy link
Copy Markdown

@chadrako
8277444: The approval request has been created successfully.

@openjdk openjdk Bot added the approval Requires approval; will be removed when approval is received label Mar 12, 2026
@openjdk openjdk Bot removed the approval Requires approval; will be removed when approval is received label Mar 24, 2026
@chadrako

chadrako commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

/approval request Re-requesting now that this has been backported to jdk17. An almost clean backport (trivial naming differences) that fixes a race condition that occurs when a class is simultaneously retransformed via the Instrumentation API and linked. This can lead to invalid bytecode which will cause a VerifyError. Even worse, if class verifying is turned off, which it is by default for java.* classes, this will cause the JVM to crash/segfault. The included test test/jdk/java/lang/instrument/RetransformBigClassTest.java fails before the patch and passes after. This patch has been in jdk25 and Corretto 11 for 6 months.

@openjdk

openjdk Bot commented Apr 3, 2026

Copy link
Copy Markdown

@chadrako
8277444: The approval request has been updated successfully.

@openjdk openjdk Bot added the approval Requires approval; will be removed when approval is received label Apr 3, 2026
@bridgekeeper

bridgekeeper Bot commented May 1, 2026

Copy link
Copy Markdown

@chadrako 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 issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@chadrako

chadrako commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

/touch

@openjdk

openjdk Bot commented May 4, 2026

Copy link
Copy Markdown

@chadrako The pull request is being re-evaluated and the inactivity timeout has been reset.

@openjdk openjdk Bot removed the rfr Pull request is ready for review label May 4, 2026
@chadrako

Copy link
Copy Markdown
Contributor Author

/template

@openjdk

openjdk Bot commented May 14, 2026

Copy link
Copy Markdown

@chadrako Missing command 'append', usage: /template append

@chadrako

Copy link
Copy Markdown
Contributor Author

/template append

@openjdk

openjdk Bot commented May 14, 2026

Copy link
Copy Markdown

@chadrako The pull request template has been appended to the pull request body

@openjdk openjdk Bot added the rfr Pull request is ready for review label May 14, 2026

@gnu-andrew gnu-andrew left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me. 11u lacks JDK-8233913 which added the earlier Thread::current() in getBytecodes so we don't have the second hunk in jvmtiEnv.cpp and have to call Thread::current() in the third. But otherwise the change is the same.

Test shows the patch works too.

@bridgekeeper

bridgekeeper Bot commented Jun 25, 2026

Copy link
Copy Markdown

@chadrako 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 issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval Requires approval; will be removed when approval is received backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants