RFR: 8266742: Check W^X state on possible safepoint [v2]

Gerard Ziemski gziemski at openjdk.java.net
Fri May 14 18:16:39 UTC 2021


On Thu, 13 May 2021 16:18:19 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Hi,
>> 
>> Please review a check for W^X mode at safepoint. As described in the bug, this explicit check aims to catch the wrong W^X mode that may lead to a crash (such crashes are rather intermittent).
>> 
>> This check helped to verify the fix for https://bugs.openjdk.java.net/browse/JDK-8265292 and should help to discover similar issues. It is disabled by default to avoid unexpected failures in the regular use, but eventually it should be turned on unconditionally.
>> 
>> I still owe a complete W^X approach description. Hope this patch does not depend much on that.
>
> Anton Kozlov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Change option and method name

Changes requested by gziemski (Committer).

src/hotspot/share/runtime/safepointMechanism.inline.hpp line 67:

> 65: }
> 66: 
> 67: void SafepointMechanism::process_if_requested(JavaThread* thread) {

Looking at the stack from the crash:


V [libjvm.dylib+0x8c1060] _ZN21MarkActivationClosure12do_code_blobEP8CodeBlob+0x3c 
V [libjvm.dylib+0x8fea78] _ZN10JavaThread11nmethods_doEP15CodeBlobClosure+0x84 
V [libjvm.dylib+0x401100] _ZN14HandshakeState18process_self_innerEv+0x18c 
V [libjvm.dylib+0x400f60] _ZN14HandshakeState15process_by_selfEv+0x48 
V [libjvm.dylib+0x832690] _ZN18SafepointMechanism25process_if_requested_slowEP10JavaThread+0x54 
V [libjvm.dylib+0x8fe4b8] _ZN10JavaThread44check_safepoint_and_suspend_for_native_transEPS_+0x24 
V [libjvm.dylib+0x92395c] _ZN19ProgrammableInvoker13invoke_nativeEPFvPhES0_P10JavaThread+0x118 
V [libjvm.dylib+0x923aa8] PI_invokeNative+0x104 
J 2565 jdk.internal.foreign.abi.ProgrammableInvoker.invokeNative(JJ)V jdk.incubator.foreign at 17-ea (0 bytes) @ 0x00000001189eeed0 


why aren't we adding the assertion closer to the frame that crashed, where we need it, like for example:

`HandshakeState::process_self_inner()`

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

PR: https://git.openjdk.java.net/jdk/pull/3920


More information about the hotspot-runtime-dev mailing list