File tree 1 file changed +8
-0
lines changed 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -3723,6 +3723,10 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
3723
3723
3724
3724
// Since this is not a JVM_ENTRY we have to set the thread state manually before entering.
3725
3725
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
+
3726
3730
ThreadStateTransition::transition_from_native (thread, _thread_in_vm);
3727
3731
if (Threads::destroy_vm ()) {
3728
3732
// Should not change thread state, VM is gone
@@ -3731,6 +3735,7 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
3731
3735
return res;
3732
3736
} else {
3733
3737
ThreadStateTransition::transition (thread, _thread_in_vm, _thread_in_native);
3738
+ MACOS_AARCH64_ONLY (thread->enable_wx (oldmode));
3734
3739
res = JNI_ERR;
3735
3740
return res;
3736
3741
}
@@ -3910,6 +3915,9 @@ jint JNICALL jni_DetachCurrentThread(JavaVM *vm) {
3910
3915
return JNI_ERR;
3911
3916
}
3912
3917
3918
+ // We are going to VM, change W^X state to the expected one.
3919
+ MACOS_AARCH64_ONLY (thread->enable_wx (WXWrite));
3920
+
3913
3921
// Safepoint support. Have to do call-back to safepoint code, if in the
3914
3922
// middle of a safepoint operation
3915
3923
ThreadStateTransition::transition_from_native (thread, _thread_in_vm);
You can’t perform that action at this time.
0 commit comments