RFR: 8369994: Mixed mode jhsdb jstack cannot resolve symbol with cold attribute [v2]

Yasumasa Suenaga ysuenaga at openjdk.org
Thu Oct 30 01:18:08 UTC 2025


On Wed, 29 Oct 2025 21:20:34 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

> is there a particular kind of system this reproduces on, or a particular way to crash things to get to abort via the "cold" route? 

Maybe it depends on compiler optimization. I use GCC 15.2.1 provided by Fedora 42 to build OpenJDK.
The app to crash is nothing special - "normal" SEGV (read `NULL` in JNI): https://github.com/YaSuenag/garakuta/tree/master/NativeSEGV
(README is in Japanese for myself, sorry 😅)

> If the DWARF lookup works at RIP-1, make the closestSymbol call always use RIP-1.

I think it is not a good idea because the crash might happen on the prologue.
For example:


push %rbp
mov %rsp, %rbp


This is prologue code in SysV AMD64. If stack pointer (`%rsp`) points invalid memory (includes guard page caused by stack overflow), the crash would happen on first `push` instruction - the symbol cannot be resolved from `RIP - 1` because this `push` instruction is located at the first of the function. `RIP - 1` is out of the function.

> Is it possible to not find DWARF and still get to resolving a symbol?

Yes, symbol resolver does not depend on DWARF. However both the symbol and DWARF are closely related to `RIP`, so I think we can handle them with same address for instruction (`RIP` or `RIP - 1`), and also it would be make easy to know what the code want to do.

I will update the comment with your suggestion if the above is ok.

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

PR Comment: https://git.openjdk.org/jdk/pull/27846#issuecomment-3465755757


More information about the serviceability-dev mailing list