8386562: JVM crashes when StackMapTable attribute is too long#31493
Open
iklam wants to merge 1 commit into
Open
8386562: JVM crashes when StackMapTable attribute is too long#31493iklam wants to merge 1 commit into
iklam wants to merge 1 commit into
Conversation
Member
Author
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
Member
|
I'm on PTO but can take a look next week |
sendaoYan
reviewed
Jun 12, 2026
| writer.write(tail); | ||
| } | ||
|
|
||
| // Generate a StackMapTable that's larger than to Metaspace::max_allocation_word_size() |
Member
There was a problem hiding this comment.
Suggested change
| // Generate a StackMapTable that's larger than to Metaspace::max_allocation_word_size() | |
| // Generate a StackMapTable that's larger than Metaspace::max_allocation_word_size() |
sendaoYan
reviewed
Jun 12, 2026
| int exitCode; | ||
| try { | ||
| Process process = builder.start(); | ||
| long timeout = COMPILE_TIMEOUT * (long)timeoutFactor; |
Member
There was a problem hiding this comment.
Should we use Utils.adjustTimeout(COMPILE_TIMEOUT) to mutiply the timeoutFactor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an unusually large StackMapTable is found in a classfile, we throw an
OutOfMemoryError. Note that we don't throw aClassFormatExceptionas the class file's format is correct, but the JVM cannot allocate enough memory to for this table.The offending class is artificially generated. Normal Java classes do not have such large tables.
See https://docs.oracle.com/en/java/javase/26/docs/specs/jvms/jvms-4.html#jvms-4.7.4
Please note that the fix is not in the class file parser but rather in the
Metaspace::allocate()interface. The behavior has changed when the requested size is larger thanMetaspace::max_allocation_word_size():assert(); a product JVM would abort with aguarantee()OutOfMemoryError.This makes the interface safer -- otherwise it would be tedious and error prone to require every caller to check for
Metaspace::max_allocation_word_size(). Usually, the code that make the allocation does not know the actual required size (e.g., the actual allocation size ofArray<b>depends on object header size as well as alignment paddings).Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31493/head:pull/31493$ git checkout pull/31493Update a local copy of the PR:
$ git checkout pull/31493$ git pull https://git.openjdk.org/jdk.git pull/31493/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 31493View PR using the GUI difftool:
$ git pr show -t 31493Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31493.diff
Using Webrev
Link to Webrev Comment