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
This commit is contained in:
Anton Kozlov 2021-05-18 18:54:16 +00:00
parent fadf58043c
commit b92c5a44f2
3 changed files with 12 additions and 4 deletions

View File

@ -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);
}

View File

@ -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, \

View File

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