Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8262894: [macos_aarch64] SIGBUS in Assembler::ld_st2
Reviewed-by: adinn, burban
Backport-of: 8a4a911
  • Loading branch information
Vladimir Kempik committed Feb 16, 2022
1 parent 69583df commit 0aa5f75
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hotspot/share/prims/jni.cpp
Expand Up @@ -4151,6 +4151,10 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {

// Since this is not a JVM_ENTRY we have to set the thread state manually before entering.
JavaThread* thread = JavaThread::current();

// We are going to VM, change W^X state to the expected one.
MACOS_AARCH64_ONLY(WXMode oldmode = thread->enable_wx(WXWrite));

ThreadStateTransition::transition_from_native(thread, _thread_in_vm);
if (Threads::destroy_vm()) {
// Should not change thread state, VM is gone
Expand All @@ -4159,6 +4163,7 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
return res;
} else {
ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native);
MACOS_AARCH64_ONLY(thread->enable_wx(oldmode));
res = JNI_ERR;
return res;
}
Expand Down Expand Up @@ -4342,6 +4347,9 @@ jint JNICALL jni_DetachCurrentThread(JavaVM *vm) {
return JNI_ERR;
}

// We are going to VM, change W^X state to the expected one.
MACOS_AARCH64_ONLY(thread->enable_wx(WXWrite));

// Safepoint support. Have to do call-back to safepoint code, if in the
// middle of a safepoint operation
ThreadStateTransition::transition_from_native(thread, _thread_in_vm);
Expand Down

1 comment on commit 0aa5f75

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.