RFR: 8368365: ASAN errors should produce hs-err files and core dumps
Thomas Stuefe
stuefe at openjdk.org
Tue Sep 23 09:27:32 UTC 2025
When we run with ASAN enabled and ASAN catches an error, it reports, then stops the JVM. hs-err files and crash dumps at that point would be incredibly useful, though. The ASAN error report itself is seldom enlightening since it only contains native stacks.
This patch makes it possible to get hs-err files and subsequent crash dumps by using the error callback functionality of ASAN. It registers a callback which gets called when ASAN catches an error. We then - carefully - print out the ASAN report to stderr (as ASAN itself would have done) and proceeed to end the JVM with a `fatal()`, which gives us an hs-err file, a callstack at that point including Java frames, and - if enabled - core dumps.
Tested on Fedora 42 and Debian 12, both manually and by running the new companion jtreg test.
-------------
Commit messages:
- remove stray modification
- stupid sort includes test
- add jtreg test
- fix error in non-asan build
- start
Changes: https://git.openjdk.org/jdk/pull/27446/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27446&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8368365
Stats: 191 lines in 7 files changed: 189 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/27446.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27446/head:pull/27446
PR: https://git.openjdk.org/jdk/pull/27446
More information about the hotspot-dev
mailing list