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

Zhengyu Gu zgu at openjdk.java.net
Thu Jun 10 14:35:13 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 could still point 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.

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

Commit messages:
 - Merge branch 'master' into JDK-8251945-race-cld
 - v0

Changes: https://git.openjdk.java.net/jdk11u-dev/pull/23/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk11u-dev&pr=23&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8268523
  Stats: 27 lines in 5 files changed: 11 ins; 6 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk11u-dev/pull/23.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk11u-dev pull/23/head:pull/23

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


More information about the jdk-updates-dev mailing list