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

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

Reviewed-by: dholmes
  • Loading branch information
AntonKozlov committed May 18, 2021
1 parent fadf580 commit b92c5a44f268c3a866fa6bc6f6218abc0457e689
Showing 3 changed files with 12 additions and 4 deletions.
@@ -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));

@@ -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/ 8015593 macosx-all
java/foreign/ 8249684 macosx-all

java/foreign/ 8263512 macosx-aarch64
java/foreign/ 8265292 macosx-aarch64
java/foreign/ 8265183 macosx-aarch64
java/foreign/ 8265182 macosx-aarch64
java/foreign/ 8263512 macosx-aarch64
java/foreign/valist/ 8263512 macosx-aarch64

1 comment on commit b92c5a4

Copy link

@openjdk-notifier openjdk-notifier bot commented on b92c5a4 May 18, 2021

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.