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

8286705: GCC 12 reports use-after-free potential bugs #8696

Closed
wants to merge 1 commit into from

Conversation

YaSuenag
Copy link
Member

@YaSuenag YaSuenag commented May 13, 2022

GCC 12 reports use-after-free potential bugs in below:

In function 'find_positions',
    inlined from 'find_file' at /home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/parse_manifest.c:364:9:
/home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/parse_manifest.c:292:34: warning: pointer 'endpos' used after 'free' [-Wuse-after-free]
  292 | pos = flen - (endpos - cp);
      | ~~~~~~~~^~~~~
/home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/parse_manifest.c:291:13: note: call to 'free' here
  291 | free(buffer);
      | ^~~~~~~~~~~~
Updating jdk/modules/jdk.jpackage/jdk/jpackage/internal/resources/jpackageapplauncher due to 1 file(s)
/home/ysuenaga/github-forked/jdk/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c: In function 'popenCommand':
/home/ysuenaga/github-forked/jdk/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c:180:63: warning: pointer 'strBufBegin' may be used after 'realloc' [-Wuse-after-free]
  180 | strBufNextChar = strNewBufBegin + (strBufNextChar - strBufBegin);
      | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/ysuenaga/github-forked/jdk/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c:174:30: note: call to 'realloc' here
  174 | strNewBufBegin = realloc(strBufBegin, strBufCapacity);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Progress

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

Issue

  • JDK-8286705: GCC 12 reports use-after-free potential bugs

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8696/head:pull/8696
$ git checkout pull/8696

Update a local copy of the PR:
$ git checkout pull/8696
$ git pull https://git.openjdk.java.net/jdk pull/8696/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8696

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8696.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented May 13, 2022

👋 Welcome back ysuenaga! 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 openjdk bot commented May 13, 2022

@YaSuenag The following label will be automatically applied to this pull request:

  • core-libs

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 core-libs label May 13, 2022
@YaSuenag YaSuenag marked this pull request as ready for review May 13, 2022
@openjdk openjdk bot added the rfr label May 13, 2022
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 13, 2022

Webrevs

Copy link

@kimbarrett kimbarrett left a comment

Looks good.

@openjdk
Copy link

@openjdk openjdk bot commented May 13, 2022

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

8286705: GCC 12 reports use-after-free potential bugs

Reviewed-by: kbarrett

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

  • f56396f: 6829250: Reg test: java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java fails in Windows
  • 273c732: 8277493: [REDO] Quarantined jpackage apps are labeled as "damaged"
  • 583a61a: 8286671: (fc) Modify sun.nio.ch.FileChannelImpl.map0() to accept a FileDescriptor parameter
  • 1e843c3: 8286604: Update InputStream and OutputStream to use @implSpec
  • 78ffefb: 8286668: JFR: Cleanup
  • 76caeed: 8285366: Fix typos in serviceability
  • f631c98: 8285380: Fix typos in security
  • 237f280: 8286393: Address possibly lossy conversions in java.rmi
  • cbe7e7b: 8284956: Potential leak awtImageData/color_data when initializes X11GraphicsEnvironment
  • 8daf08d: 8286628: Remove unused BufferNode::Allocator::flush_free_list
  • ... and 4 more: https://git.openjdk.java.net/jdk/compare/d5ae3833b1b71eb84fadb69c0c92851400f8921c...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 label May 13, 2022
@YaSuenag
Copy link
Member Author

@YaSuenag YaSuenag commented May 15, 2022

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented May 15, 2022

Going to push as commit 0e4bece.
Since your change was applied there have been 20 commits pushed to the master branch:

  • 63bd3b7: 8286773: cleanup @returns in sun.security classes
  • af24d2d: 8286771: workaround implemented for JDK-8282607 is incomplete
  • 80cf9f3: 8286594: (zipfs) Mention paths with dot elements in ZipException and cleanups
  • 29c4b8e: 8286444: javac errors after JDK-8251329 are not helpful enough to find root cause
  • 9eb15c9: 8286681: ShenandoahControlThread::request_gc misses the case of GCCause::_codecache_GC_threshold
  • e4378ab: 8286559: Re-examine synchronization of mark and reset methods on InflaterInputStream
  • f56396f: 6829250: Reg test: java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java fails in Windows
  • 273c732: 8277493: [REDO] Quarantined jpackage apps are labeled as "damaged"
  • 583a61a: 8286671: (fc) Modify sun.nio.ch.FileChannelImpl.map0() to accept a FileDescriptor parameter
  • 1e843c3: 8286604: Update InputStream and OutputStream to use @implSpec
  • ... and 10 more: https://git.openjdk.java.net/jdk/compare/d5ae3833b1b71eb84fadb69c0c92851400f8921c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated label May 15, 2022
@openjdk openjdk bot closed this May 15, 2022
@YaSuenag YaSuenag deleted the JDK-8286705 branch May 15, 2022
@openjdk openjdk bot removed ready rfr labels May 15, 2022
@openjdk
Copy link

@openjdk openjdk bot commented May 15, 2022

@YaSuenag Pushed as commit 0e4bece.

💡 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
core-libs integrated
2 participants