JDK-8264240 : [macos_aarch64] enable appcds support after JDK-8263002
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: aarch64
  • Submitted: 2021-03-26
  • Updated: 2021-04-01
  • Resolved: 2021-03-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b16Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
After JEP-391 was integrated, the appcds was left disabled by default on macos_aarch64 platform.
This happened because of one issue with implementation of appcds on macos_aarch64:
appcds needs to be able to allocate RWX memory at specific address. And on macos_aarch64 one can't use both flags MAP_FIXED  and MAP_JIT for mmap call, it's forbidden by the platform.
Some workaround for the issue is needed

Update: it seems the support can be enabled back after JDK-8263002
Comments
To clarify, as noted in JDK-8262894: "The issue will also appear when a code is generated as preparation for shutdownHooks during execution of JNI DestroyJavaVM. " The stack above shows how this can manifest if a class needs to be linked during execution of the shutdown hooks. In this particular case a class needed to be linked due to dynamic CDS dumping. Hence with CDS dynamic dumping enabled tests may exhibit the crash that JDK-8262894 is fixing. Hence my suggestion that enabling CDS should probably have waited until JDK-8262894 was fixed.
30-03-2021

[~iklam] I don't see how that bug affects the crash that was observed: Stack: [0x000000016afa0000,0x000000016b1a3000], sp=0x000000016b1a2110, free space=2056k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.dylib+0xf8549c] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x5d8 V [libjvm.dylib+0xf85b48] VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, char*)+0x40 V [libjvm.dylib+0x5125f8] report_vm_error(char const*, int, char const*, char const*, ...)+0x80 V [libjvm.dylib+0xdd559c] SharedRuntime::gen_i2c_adapter(MacroAssembler*, int, int, BasicType const*, VMRegPair const*)+0x80 V [libjvm.dylib+0xdd5ea8] SharedRuntime::generate_i2c2i_adapters(MacroAssembler*, int, int, BasicType const*, VMRegPair const*, AdapterFingerPrint*)+0x40 V [libjvm.dylib+0xdcc7e4] AdapterHandlerLibrary::get_adapter(methodHandle const&)+0x3e0 V [libjvm.dylib+0xc2c5ac] Method::make_adapters(methodHandle const&, Thread*)+0x1c V [libjvm.dylib+0x79b30c] InstanceKlass::link_methods(Thread*)+0x7c V [libjvm.dylib+0x79a270] InstanceKlass::link_class_impl(Thread*)+0x3d4 V [libjvm.dylib+0xc21040] MetaspaceShared::try_link_class(Thread*, InstanceKlass*)+0x104 V [libjvm.dylib+0xc21320] MetaspaceShared::link_and_cleanup_shared_classes(Thread*)+0x1b4 V [libjvm.dylib+0xef2e64] JavaThread::invoke_shutdown_hooks()+0x38 V [libjvm.dylib+0xef30d0] Threads::destroy_vm()+0x1e8 V [libjvm.dylib+0x8a6c80] jni_DestroyJavaVM+0xdc C [libjli.dylib+0x5530] JavaMain+0xc5c C [libjli.dylib+0x7590] ThreadJavaMain+0xc C [libsystem_pthread.dylib+0x6fd4] _pthread_start+0x140
30-03-2021

[~dholmes] After JDK-8263002, CDS no longer uses a writeable+executable section, so CDS is no longer affected by JDK-8262894.
30-03-2021

> JDK-8262894 was seen before appcds was enabled. Yes but it also affects CDS
29-03-2021

tier1/tier2, althought cds tests are only in hs:tier1 JDK-8262894 was seen before appcds was enabled.
29-03-2021

[~vkempik] what testing did you do here? With CDS enabled you will hit crashes due to JDK-8262894.
29-03-2021

Changeset: d6bb1537 Author: Vladimir Kempik <vkempik@openjdk.org> Date: 2021-03-26 19:50:01 +0000 URL: https://git.openjdk.java.net/jdk/commit/d6bb1537
26-03-2021

The dependency on RWX mapping has been removed since JDK-8263002 (Remove CDS MiscCode region)
26-03-2021