Skip to content

Commit

Permalink
8262894: [macos_aarch64] SIGBUS in Assembler::ld_st2
Browse files Browse the repository at this point in the history
Co-authored-by: Mikael Vidstedt <mikael@openjdk.org>
Reviewed-by: dholmes, gziemski
  • Loading branch information
2 people authored and Vladimir Kempik committed Mar 31, 2021
1 parent ab6faa6 commit 8a4a911
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hotspot/share/prims/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3723,6 +3723,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 @@ -3731,6 +3735,7 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
return res;
} else {
ThreadStateTransition::transition(thread, _thread_in_vm, _thread_in_native);
MACOS_AARCH64_ONLY(thread->enable_wx(oldmode));
res = JNI_ERR;
return res;
}
Expand Down Expand Up @@ -3910,6 +3915,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 8a4a911

@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.