Cleanup os::reserve_memory and remove MAP_FIXED

XMLWordPrintable

    • b18

        There's a code path through os::reserve_memory that uses MAP_FIXED. This path is used if a requested address is given.

        It's very dangerous to use MAP_FIXED, since it causes preexisting mappings to be replaced.

        Mac AARCH64 also can't use it in conjunction with MAP_JIT.

        I started to split os::reserve_memory into two functions; one that doesn't care about were the memory is mapped, and another (os::reserve_memory_at) that uses the dangerous MAP_FIXED flag. However, I noticed that it's only windows code that actually use os::reserve_memory with a requested address. All other usages have been cleaned out and replaced with os::attempt_reserve_memory. And on windows os::attempt_reserve_memory uses os::reserve_memory with comments that it's safe because it only "attempts" to place the mapping.

        So, this patch:
        1) Removes the forcefully reserving of memory
        2) Changes the windows code to call the attempt_reserve_memory verison, that it actually did anyway.
        3) There's also some unification and split done to handle MEMFLAGS and fds. This part needs followup cleanups (IMHO).

              Assignee:
              Stefan Karlsson
              Reporter:
              Stefan Karlsson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: