--- old/hotspot/src/os/linux/vm/os_linux.cpp 2010-03-04 15:19:34.443296255 +0000 +++ new/hotspot/src/os/linux/vm/os_linux.cpp 2010-03-04 15:19:34.363150170 +0000 @@ -54,6 +54,10 @@ # include # include +#include +#include +#include + #define MAX_PATH (2 * K) // for timer info max values which include all bits @@ -2492,6 +2496,53 @@ != MAP_FAILED; } +static bool +get_stack_bounds(uintptr_t *bottom, uintptr_t *top) +{ + using namespace std; + + ostringstream oss; + oss << "/proc/" << syscall(SYS_gettid) << "/maps"; + ifstream cin(oss.str().c_str()); + while (!cin.eof()) + { + string str; + getline(cin,str); + const string stack_str = "[stack]"; + if (str.length() > stack_str.length() + && (str.compare(str.length() - stack_str.length(), + stack_str.length(), stack_str) + == 0)) + { + istringstream iss(str); + iss.flags(ios::hex); + iss >> *bottom; + char c; + iss >> c; + iss >> *top; + uintptr_t sp = (intptr_t)__builtin_frame_address(0); + if (sp >= *bottom && sp <= *top) + return true; + } + } + + return false; +} + +bool os::create_stack_guard_pages(char* addr, size_t size) { + uintptr_t stack_extent, stack_base; + if (get_stack_bounds(&stack_extent, &stack_base)) { + if (stack_extent < (uintptr_t)addr) + ::munmap((void*)stack_extent, (uintptr_t)addr - stack_extent); + } + + return os::commit_memory(addr, size); +} + +bool os::remove_stack_guard_pages(char* addr, size_t size) { + return ::munmap(addr, size) == 0; +} + static address _highest_vm_reserved_address = NULL; // If 'fixed' is true, anon_mmap() will attempt to reserve anonymous memory --- old/hotspot/src/os/solaris/vm/os_solaris.cpp 2010-03-04 15:19:34.872236806 +0000 +++ new/hotspot/src/os/solaris/vm/os_solaris.cpp 2010-03-04 15:19:34.791259348 +0000 @@ -2698,6 +2698,14 @@ } } +bool os::create_stack_guard_pages(char* addr, size_t size) { + return os::commit_memory(addr, size); +} + +bool os::remove_stack_guard_pages(char* addr, size_t size) { + return os::uncommit_memory(addr, size); +} + // Change the page size in a given range. void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned."); --- old/hotspot/src/os/windows/vm/os_windows.cpp 2010-03-04 15:19:35.305211693 +0000 +++ new/hotspot/src/os/windows/vm/os_windows.cpp 2010-03-04 15:19:35.223313441 +0000 @@ -2803,6 +2803,14 @@ return VirtualFree(addr, 0, MEM_RELEASE) != 0; } +bool os::create_stack_guard_pages(char* addr, size_t size) { + return os::commit_memory(addr, size); +} + +bool os::remove_stack_guard_pages(char* addr, size_t size) { + return os::uncommit_memory(addr, size); +} + // Set protections specified bool os::protect_memory(char* addr, size_t bytes, ProtType prot, bool is_committed) { --- old/hotspot/src/share/vm/runtime/os.hpp 2010-03-04 15:19:35.703220693 +0000 +++ new/hotspot/src/share/vm/runtime/os.hpp 2010-03-04 15:19:35.625397773 +0000 @@ -218,6 +218,9 @@ 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); --- old/hotspot/src/share/vm/runtime/thread.cpp 2010-03-04 15:19:36.046149900 +0000 +++ new/hotspot/src/share/vm/runtime/thread.cpp 2010-03-04 15:19:35.969155846 +0000 @@ -2134,7 +2134,7 @@ 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; } @@ -2155,7 +2155,7 @@ 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."); --- old/jaxws/jaxws.properties 2010-03-04 15:19:36.428211437 +0000 +++ new/jaxws/jaxws.properties 2010-03-04 15:19:36.373150534 +0000 @@ -24,7 +24,7 @@ # drops.master.copy.base=${drops.dir} -drops.master.url.base=http://kenai.com/projects/jdk7-drops/downloads/download +drops.master.url.base=http://icedtea.classpath.org/download/source/drops/ jaxws_src.bundle.name=jdk7-jaxws-2009_09_28.zip jaxws_src.bundle.md5.checksum=f5010ebf636db9f465a61a7a74944543