[jdk11u-dev] RFR: 8251945: SIGSEGV in PackageEntry::purge_qualified_exports() [v7]

Zhengyu Gu zgu at openjdk.java.net
Fri Jun 18 15:13:10 UTC 2021


> I would like to fix the crash in openjdk 11u.
> 
> The crash is caused by racy installing new CLD in ClassLoaderDataGraph::add_to_graph().
> 
> The method first creates new ClassLoaderData, and in its constructor, it creates unnamed module entry and installs it in java_lang_Module oop.
> 
> Then add_to_graph() tries to install newly created CLD to java_lang_ClassLoader oop via CAS. If it loses race, then it deletes new CLD and returns existing one.
> 
> But at this point, java_lang_Module oop still points module entry that is already freed.
> 
> The fix I am purposing is to borrow ClassLoaderDataGraph_lock from JDK-8210155, but only uses it to prevent racing installing CLD and new CLD is still published via CAS to avoid needing additional patches.
> 
> Test:
>  - [x] hotspot_runtime
>  - [x] hotspot_gc
>  - [x] vmTestbase_vm_gc

Zhengyu Gu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:

 - Fixed copyright year
 - Merge branch 'master' into JDK-8251945-race-cld
 - Andrew Dinn's comments and copyright years
 - Removed trailing whitespaces
 - Change ClassLoaderDataGraph_lock to _safepoint_check_always to be consistent with later version
 - Copyright years
 - Need Acquire/Release order accessing CLD
 - Add reproducer test
 - Merge branch 'master' into JDK-8251945-race-cld
 - v0

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk11u-dev/pull/22/files
  - new: https://git.openjdk.java.net/jdk11u-dev/pull/22/files/2668e85f..c017eaa4

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk11u-dev&pr=22&range=06
 - incr: https://webrevs.openjdk.java.net/?repo=jdk11u-dev&pr=22&range=05-06

  Stats: 175 lines in 26 files changed: 97 ins; 2 del; 76 mod
  Patch: https://git.openjdk.java.net/jdk11u-dev/pull/22.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk11u-dev pull/22/head:pull/22

PR: https://git.openjdk.java.net/jdk11u-dev/pull/22


More information about the jdk-updates-dev mailing list