RFR: 8262952: [macos_aarch64] os::commit_memory failure

Gerard Ziemski gziemski at openjdk.java.net
Fri May 7 16:20:26 UTC 2021


On x86_64 macOS the following sequence works just fine:

attempt_reserve_memory_at(executable=false)
commit_memory(executable=true)

however, on aarch64 macOS it fails. The way to get "commit_memory(executable=true)" to work is to make the memory chunk executable right from the start at the time we reserve it.

Please note, that:

attempt_reserve_memory_at(executable=true)
commit_memory(executable=false)

works, so we can always downgrade memory by removing its "executable" privilege at the time we commit it some time later.

-------------

Commit messages:
 - move the fix to modify the const int flags, leave the exec argument alone
 - pasted the workaround in wrong place, no need for __APPLE__ check
 - always use MAP_JIT when reserving memory on aarch64 macOS

Changes: https://git.openjdk.java.net/jdk/pull/3865/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3865&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262952
  Stats: 8 lines in 2 files changed: 3 ins; 4 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3865.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3865/head:pull/3865

PR: https://git.openjdk.java.net/jdk/pull/3865


More information about the hotspot-runtime-dev mailing list