RFR: 8316309: AArch64: VMError::print_native_stack() crashes on Java native method frame [v2]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Fri Sep 29 16:35:18 UTC 2023
> Please review the following patch. As explained in the bug comments the problem is that os::get_sender_for_C_frame() always constructs a frame as if the sender is also a native C/C++ frame. Setting a correct value for _unextended_sp is important to avoid crashes if this value is later used to get that frame's caller, which will happen if we end up calling frame::sender_for_compiled_frame().
>
> The issue exists on aarch64 for both linux and macos but the fix for linux is different. The "Procedure Call Standard for the Arm 64-bit Architecture" doesn't specify a location for the frame record within a stack frame (6.4.6), and gcc happens to choose to save it the top of the frame (lowest address) rather than the bottom. This means that changing fr->link() for fr->sender_sp() won't work. The fix is to use the value of fr->link() but adjusted using the code blob frame size before setting it as the _unextended_sp of the sender frame. While working on this fix I realized the issue is not only when the sender is a native nmethod but with all frames associated with a CodeBlob with a frame size > 0 (runtime stub, safepoint stub, etc) so the check takes that into account. I also made a small fix to next_frame() since these mentioned frames should also use frame::sender().
>
> I created a new test to verify that walking the stack over a native nmethod or runtime stub now works okay. I'll try to add a reliable test case for walking over a safepoint stub too. I tested the fix by running the new test and also running tiers1-4 in mach5. I'll run the upper tiers too.
>
> Thanks,
> Patricio
Patricio Chilano Mateo has updated the pull request incrementally with two additional commits since the last revision:
- add comment to tests
- use driver + @requires vm.flagless
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/15972/files
- new: https://git.openjdk.org/jdk/pull/15972/files/eceeed15..8757025e
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=15972&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=15972&range=00-01
Stats: 6 lines in 1 file changed: 5 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/15972.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15972/head:pull/15972
PR: https://git.openjdk.org/jdk/pull/15972
More information about the hotspot-dev
mailing list