RFR: JDK-8327971: Multiple ASAN errors reported for metaspace [v7]

Thomas Stuefe stuefe at openjdk.org
Tue Mar 26 10:19:00 UTC 2024


> We have multiple issues that cause the ASAN build in fastdebug to not work, or to fail gtests.
> 
> 1) When adding ASAN support for metaspace, we decided to track poisoning not at the OS border (map) but at the border between metaspace and outer JVM code. More precisely, at the border of ChunkManager chunk allocation/deallocation. Chunks handed out by the chunk manager are unpoisoned and poisoned when handed back.
> 
> This causes some problems since within metaspace, we access memory that is committed but not yet handed to the user (for zapping or for verification in debug builds). So, from the ASANs' view, those accesses are invalid, whereas for Metaspace, those accesses are perfectly valid.
> 
> In these cases, we need to unpoison the memory or exclude the code section, if possible, for ASAN builds. This affects both JVM code and gtests.
> 
> 2) NMT gtests sometimes do dangerous things deliberately (accessing invalid memory to track error recognition), and these tests should be disabled with ASAN

Thomas Stuefe 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 12 additional commits since the last revision:

 - Merge branch 'master' into JDK-8327971-Multiple-ASAN-errors-reported-for-metaspace
 - Roman feedback
 - Revert accidentally added patch
 - Fix DirectivesParserTest for ASAN
 - disable dirty NMT tests that trigger ASAN
 - fix location printing nmt
 - move code around
 - remove stray newline
 - fixes
 - move comment
 - ... and 2 more: https://git.openjdk.org/jdk/compare/43923b8c...c125b7e8

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/18230/files
  - new: https://git.openjdk.org/jdk/pull/18230/files/61e5a602..c125b7e8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18230&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18230&range=05-06

  Stats: 373706 lines in 3158 files changed: 28224 ins; 20307 del; 325175 mod
  Patch: https://git.openjdk.org/jdk/pull/18230.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18230/head:pull/18230

PR: https://git.openjdk.org/jdk/pull/18230


More information about the hotspot-runtime-dev mailing list