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

Gerard Ziemski gziemski at openjdk.java.net
Wed May 12 15:13:53 UTC 2021


On Wed, 12 May 2021 14:45:42 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> 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.
>> 
>> We fix the test itself to explicitly ask for executable memory when reserving it since it later commits it as executable.
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use the existing executable flag to indicate whether we want to commit exec memory or not

Talking about "exec" permission of the memory in `os::pd_commit_memory` got me thinking about the permissions we currently set on it, which is:

`int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE`
 
I'm sure there must be a reason, that I don't know, but why do we need it to be of "PROT_READ"? Java2Demo, for example,  seems to run fine without the "read" permission on it, i.e.:

`int prot = exec ? PROT_WRITE|PROT_EXEC : PROT_WRITE;`

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

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


More information about the hotspot-runtime-dev mailing list