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

Gerard Ziemski gziemski at openjdk.java.net
Tue May 11 15:44:52 UTC 2021


On Tue, 11 May 2021 13:32:54 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Inside the hotspot VM code we seem to be doing the right thing, however, in the test, i.e. `test/hotspot/gtest/runtime/test_os.cpp` we ask for regular memory, then try to commit a chunk with elevated exec privileges, which seems to work on all other platforms, except aarch64 macOS.
>> 
>> The alternative, would be to fix the test in question, but since this scenario works fine on all the other platforms, I figured the proposed way to handle it in the VM  would be the preferable way to fix it, so future test writers do not need to know this particular platform behavior difference and risk getting it wrong again.
>
> Hi @gerard-ziemski,
> 
> please fix the test instead. This would be a security issue, especially since the locations of some of our mappings are very predictable (eg CDS archive).
> 
> If this is about the "multi-release" test in test_os.cpp (377ff), just disable the exec flag there. I use alternating exec 
>  flags to prevent the kernel from folding neighboring mappings, but actually that part is rather linux specific. Arguably we may even completely exclude the test, like I do for AIX already. Its important for Windows, somewhat less important for Linux, and covers other platforms only for completeness sake.
> 
> Wrt to MAP_JIT , what we do now is the result of long discussions: https://git.openjdk.java.net/jdk/pull/294.
> 
> Cheers, Thomas

I did struggle deciding whether it's a good compromise to make the testing more convenient and consistent among platforms by allowing memory on macOS aarch64 executable right from start, which is why I mentioned that we can (and do) remove that privilege later when we commit it, but after stepping away from this code for a moment and looking at it now, I do agree that it was bad choice.

I'll fix the test instead.

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

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


More information about the hotspot-runtime-dev mailing list