RFR: 8263476: Use reserved memory for stack guard pages [v3]

Zhengyu Gu zgu at openjdk.org
Tue Aug 5 18:03:04 UTC 2025


On Mon, 4 Aug 2025 14:04:15 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Use reserved (instead of committed) memory for stack-guard-pages on linux like systems.
>> 
>> `os::must_commit_stack_guard_pages` uses `commit` in its name, but `commit` usually has specific meanings in OS memory context. The actual question the caller is asking is whether the caller needs to do some preparation work before marking the guard-pages as inaccessible. To avoid confusion, I changed it to "allocate". Other suggestions are welcome.
>> 
>> Test: tier1-3
>
> Albert Mingkun Yang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review

src/hotspot/os/linux/os_linux.cpp line 3478:

> 3476:       ::munmap((void*)stack_extent, (uintptr_t)(addr + size - stack_extent));
> 3477:     }
> 3478:     return os::pd_attempt_reserve_memory_at(addr, size, !ExecMem) != nullptr;

This patch indeed goes beyond my original intention. IIRC,  my intention was to replace `os::commit()` with `::mprotect()` to set protection on stack guard pages.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26571#discussion_r2254990412


More information about the hotspot-runtime-dev mailing list