Skip to content

Commit 8a4a911

Browse files
AntonKozlovvidmik
authored and
Vladimir Kempik
committed
8262894: [macos_aarch64] SIGBUS in Assembler::ld_st2
Co-authored-by: Mikael Vidstedt <[email protected]> Reviewed-by: dholmes, gziemski
1 parent ab6faa6 commit 8a4a911

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/hotspot/share/prims/jni.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3723,6 +3723,10 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
37233723

37243724
// Since this is not a JVM_ENTRY we have to set the thread state manually before entering.
37253725
JavaThread* thread = JavaThread::current();
3726+
3727+
// We are going to VM, change W^X state to the expected one.
3728+
MACOS_AARCH64_ONLY(WXMode oldmode = thread->enable_wx(WXWrite));
3729+
37263730
ThreadStateTransition::transition_from_native(thread, _thread_in_vm);
37273731
if (Threads::destroy_vm()) {
37283732
// Should not change thread state, VM is gone
@@ -3731,6 +3735,7 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
37313735
return res;
37323736
} else {
37333737
ThreadStateTransition::transition(thread, _thread_in_vm, _thread_in_native);
3738+
MACOS_AARCH64_ONLY(thread->enable_wx(oldmode));
37343739
res = JNI_ERR;
37353740
return res;
37363741
}
@@ -3910,6 +3915,9 @@ jint JNICALL jni_DetachCurrentThread(JavaVM *vm) {
39103915
return JNI_ERR;
39113916
}
39123917

3918+
// We are going to VM, change W^X state to the expected one.
3919+
MACOS_AARCH64_ONLY(thread->enable_wx(WXWrite));
3920+
39133921
// Safepoint support. Have to do call-back to safepoint code, if in the
39143922
// middle of a safepoint operation
39153923
ThreadStateTransition::transition_from_native(thread, _thread_in_vm);

0 commit comments

Comments
 (0)