mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
6929067: Stack guard pages should be removed when thread is detached
Add code to unmap stack guard area when thread is detached. Reviewed-by: coleenp, kamg
This commit is contained in:
parent
8d1747bc4b
commit
053d7adeb2
8 changed files with 271 additions and 2 deletions
|
@ -218,6 +218,9 @@ class os: AllStatic {
|
|||
|
||||
static bool guard_memory(char* addr, size_t bytes);
|
||||
static bool unguard_memory(char* addr, size_t bytes);
|
||||
static bool create_stack_guard_pages(char* addr, size_t bytes);
|
||||
static bool remove_stack_guard_pages(char* addr, size_t bytes);
|
||||
|
||||
static char* map_memory(int fd, const char* file_name, size_t file_offset,
|
||||
char *addr, size_t bytes, bool read_only = false,
|
||||
bool allow_exec = false);
|
||||
|
|
|
@ -2137,7 +2137,7 @@ void JavaThread::create_stack_guard_pages() {
|
|||
int allocate = os::allocate_stack_guard_pages();
|
||||
// warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len);
|
||||
|
||||
if (allocate && !os::commit_memory((char *) low_addr, len)) {
|
||||
if (allocate && !os::create_stack_guard_pages((char *) low_addr, len)) {
|
||||
warning("Attempt to allocate stack guard pages failed.");
|
||||
return;
|
||||
}
|
||||
|
@ -2158,7 +2158,7 @@ void JavaThread::remove_stack_guard_pages() {
|
|||
size_t len = (StackYellowPages + StackRedPages) * os::vm_page_size();
|
||||
|
||||
if (os::allocate_stack_guard_pages()) {
|
||||
if (os::uncommit_memory((char *) low_addr, len)) {
|
||||
if (os::remove_stack_guard_pages((char *) low_addr, len)) {
|
||||
_stack_guard_state = stack_guard_unused;
|
||||
} else {
|
||||
warning("Attempt to deallocate stack guard pages failed.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue