jdk8u-dev icon indicating copy to clipboard operation
jdk8u-dev copied to clipboard

8159695: Arguments::atojulong() fails to detect overflows

Open ktakakuri opened this issue 1 year ago • 33 comments
trafficstars

Hi all, this is a backport of JDK-8159695: Arguments::atojulong() fails to detect overflows. The bug reported is reproducible in JDK8, so this patch should be applied. The original patch does not apply cleanly, and the following modifications are needed:

  • Lines related to hexadecimal numbers are skipped because support for hexadecimal numbers as a VM option, corresponding to JDK-8042885, was not introduced until JDK9.
  • The accompanying test to check the functionality of the atojulong() function is dropped because it is a GTest, which is not available in JDK8.

Note that atomull() was renamed to atojulong() in JDK9 as part of the enhancement JDK-8153073, which supports suffixes in memory size options. Testing

  • Manually check the behaviour When a given value is too large to fit in a julong, the proper exception is raised with this patch.

without patch

java -XX:GCDrainStackTargetSize=999999999999999999999999999999 -XX:+PrintFlagsFinal -version | grep StackTarget

    uintx GCDrainStackTargetSize                   := 18446744073709551615                    {product}

with patch

java -XX:GCDrainStackTargetSize=999999999999999999999999999999 -XX:+PrintFlagsFinal -version
Improperly specified VM option 'GCDrainStackTargetSize=999999999999999999999999999999'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
  • hotspot_tier1

Thank you.


Progress

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

Issue

  • JDK-8159695: Arguments::atojulong() fails to detect overflows (Bug - P3 - Requested)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 428

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

Using diff file

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

Using Webrev

Link to Webrev Comment

ktakakuri avatar Jan 25 '24 05:01 ktakakuri

:wave: Welcome back ktakakuri! 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.

bridgekeeper[bot] avatar Jan 25 '24 05:01 bridgekeeper[bot]

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

openjdk[bot] avatar Jan 25 '24 06:01 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jan 25 '24 06:01 mlbridge[bot]

@ktakakuri 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!

bridgekeeper[bot] avatar Feb 22 '24 08:02 bridgekeeper[bot]

⚠️ @ktakakuri This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

openjdk[bot] avatar Feb 29 '24 22:02 openjdk[bot]

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

openjdk[bot] avatar Mar 13 '24 20:03 openjdk[bot]

@ktakakuri 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!

bridgekeeper[bot] avatar Apr 11 '24 03:04 bridgekeeper[bot]

As phohensee has pointed out ,strtoull needs to be declared for Windows-x86. A corresponding fix exists in JDK9, but it's in a different context. I am currently working on backporting this fix in issue #434. Once issue #434 is integrated, the build failure will be resolved and GHA result is fine (see #434).

ktakakuri avatar Apr 16 '24 14:04 ktakakuri

/approval request Fix Request 8u This bug is reproducible in JDK8, and backporting this patch is needed. The patch does not apply cleanly, with GTest and hexadecimal-related lines being dropped. Low risk as it only relates to edge cases of the string-julong conversion. For building in Windows x86, the appropriate macro definition is needed and the correspoding backport has been submitted. Tesing: GHA, hotspot_tier1, and manually check the behaviour.

ktakakuri avatar Apr 16 '24 14:04 ktakakuri

@ktakakuri 8159695: The approval request has been created successfully.

openjdk[bot] avatar Apr 16 '24 14:04 openjdk[bot]

@ktakakuri 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!

bridgekeeper[bot] avatar May 14 '24 17:05 bridgekeeper[bot]

@ktakakuri 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[bot] avatar Jun 11 '24 18:06 bridgekeeper[bot]

/open

ktakakuri avatar Jun 11 '24 23:06 ktakakuri

@ktakakuri This pull request is now open

openjdk[bot] avatar Jun 11 '24 23:06 openjdk[bot]

I think this one should depend on #434, not the other way around, so VS2010 builds pass.

gnu-andrew avatar Jun 15 '24 17:06 gnu-andrew

I think it would be good to merge this backport after #434 is merged. The fix is no problem as is.

ktakakuri avatar Jun 24 '24 01:06 ktakakuri

@ktakakuri 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!

bridgekeeper[bot] avatar Jul 22 '24 05:07 bridgekeeper[bot]

This pull request is pending approval of the Fix Request. I comment to not close.

ktakakuri avatar Aug 05 '24 12:08 ktakakuri

@ktakakuri 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!

bridgekeeper[bot] avatar Sep 02 '24 13:09 bridgekeeper[bot]

This pull request is pending approval of the Fix Request. I comment to not close.

ktakakuri avatar Sep 03 '24 11:09 ktakakuri

@ktakakuri 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!

bridgekeeper[bot] avatar Oct 01 '24 13:10 bridgekeeper[bot]

This pull request is pending approval of the Fix Request. I comment to not close.

ktakakuri avatar Oct 02 '24 09:10 ktakakuri