Skip to content
Permalink
Browse files
8265292: [macos_aarch64] java/foreign/TestDowncall.java crashes with …
…SIGBUS

8265183: [macos_aarch64] java/foreign/TestIntrinsics.java crashes with SIGBUS
8265182: [macos_aarch64] java/foreign/TestUpcall.java crashes with SIGBUS

Reviewed-by: dholmes
  • Loading branch information
AntonKozlov committed May 18, 2021
1 parent fadf580 commit b92c5a44f268c3a866fa6bc6f6218abc0457e689
Showing with 12 additions and 4 deletions.
  1. +4 −1 src/hotspot/share/prims/universalNativeInvoker.cpp
  2. +8 −0 src/hotspot/share/runtime/interfaceSupport.inline.hpp
  3. +0 −3 test/jdk/ProblemList.txt
@@ -31,8 +31,11 @@ ProgrammableInvoker::Generator::Generator(CodeBuffer* code, const ABIDescriptor*
_layout(layout) {}

void ProgrammableInvoker::invoke_native(Stub stub, address buff, JavaThread* thread) {
MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXExec, thread));
ThreadToNativeFromVM ttnfvm(thread);
// We need WXExec because we are about to call a generated stub. Like in VM
// entries, the thread state should be changed while we are still in WXWrite.
// See JDK-8265292.
MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXExec, thread));
stub(buff);
}

@@ -290,6 +290,14 @@ class VMNativeEntryWrapper {

// LEAF routines do not lock, GC or throw exceptions

// On macos/aarch64 we need to maintain the W^X state of the thread. So we
// take WXWrite on the enter to VM from the "outside" world, so the rest of JVM
// code can assume writing (but not executing) codecache is always possible
// without preliminary actions.
// JavaThread state should be changed only after taking WXWrite. The state
// change may trigger a safepoint, that would need WXWrite to do bookkeeping
// in the codecache.

#define VM_LEAF_BASE(result_type, header) \
debug_only(NoHandleMark __hm;) \
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, \
@@ -543,9 +543,6 @@ java/beans/XMLEncoder/Test6570354.java 8015593 macosx-all
java/foreign/TestMismatch.java 8249684 macosx-all

java/foreign/StdLibTest.java 8263512 macosx-aarch64
java/foreign/TestDowncall.java 8265292 macosx-aarch64
java/foreign/TestIntrinsics.java 8265183 macosx-aarch64
java/foreign/TestUpcall.java 8265182 macosx-aarch64
java/foreign/TestVarArgs.java 8263512 macosx-aarch64
java/foreign/valist/VaListTest.java 8263512 macosx-aarch64

0 comments on commit b92c5a4

Please sign in to comment.