RFR: JDK-8327971: Multiple ASAN errors reported for metaspace

Thomas Stuefe stuefe at openjdk.org
Tue Mar 12 14:04:20 UTC 2024


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 (or, more precisely, at the border of ChunkManager chunk allocation/deallocation).

Chunks handed out by the chunk manager are unpoisoned, poisoned when handed back.

This causes some problems, since within metaspace we access memory that is committed but not yet handed to the user. So from the ASANs view, that memory is poisoned; from the view of the metaspace allocator, these accesses are perfectly valid.

Basic problem here is ASAN does not distinguish between illegal access from JVM caller code and legal access from within metaspace. 

The fixes required are minor. Without them even the ASAN build will fail. The ASAN errors are mostly caused by sections that are guarded with `MetaspaceTestInterval`.

With the patch, ASAN build succeeds, and we survive metaspace gtests with `MetaspaceTestInterval` cranked up to the highest level.

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

Commit messages:
 - start

Changes: https://git.openjdk.org/jdk/pull/18230/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18230&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8327971
  Stats: 22 lines in 4 files changed: 17 ins; 0 del; 5 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