RFR: 8371046: Segfault in compiler/whitebox/StressNMethodRelocation.java with -XX:+UseZGC

Chad Rakoczy duke at openjdk.org
Mon Nov 24 22:03:39 UTC 2025


On Sat, 22 Nov 2025 16:54:42 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> May be we should change the assert to guarantee in Relocation::pd_set_call_destination() to make sure we catch incorrect patching it product VM.

I'm not opposed to changing this. Is this the main concern?

> Looking on `NativeCall::set_destination_mt_safe` and `reachable` is calculated based on distance between address of call instruction and destination. Which could be different for cloned nmethod.

I'm not sure I understand what you're saying here. I agree the offset is most likely different after the nmethod is cloned. The offset gets fixed by `trampoline_stub_Relocation::fix_relocation_after_move` since it could be out of range. Since `CallRelocation::fix_relocation_after_move` sets the destination to whatever was passed (regardless of if it is in range or not) it does not make sense to call this on the relocated nmethod which is why we skip it.

I believe `Relocation::pd_set_call_destination` for aarch64 could use `set_destination_mt_safe` instead of `set_destination` which was an alternative approach in the original PR. The original discussion is [here](https://github.com/openjdk/jdk/pull/23573#discussion_r2123618495).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28241#discussion_r2557844143


More information about the graal-dev mailing list