Description
The Posix standard http://pubs.opengroup.org/onlinepubs/9699919799/
says "the implementation allocates extra memory at the overflow end of the stack". The linux man page https://linux.die.net/man/3/pthread_attr_setguardsize says "As at glibc 2.8, the NPTL threading implementation includes the guard area within the stack size allocation, rather than allocating extra space at the end of the stack, as POSIX.1 requires".
I encounter this problem in runtime/Thread/TooSmallStackSize.java on ppc with 64K pages. _compiler_thread_min_stack_allowed is 128K on ppc, and ppc specifies two OS guard pages. The VM crashes in pthread creation because there is no usable space
in the thread stack after allocating the guard pages.
This fix adapts the requested stack size on Linux by the size of the guard pages to mimick proper behaviour.
Attachments
Issue Links
- relates to
-
JDK-8140520 segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
- Resolved
-
JDK-8273373 Zero: Cannot invoke JVM in primordial threads on Zero
- Resolved
-
JDK-8280059 Incorrect glibc version is used in a comment in os_linux.cpp
- Resolved
-
JDK-8175342 assert(InstanceKlass::cast(k)->is_initialized()) failed: need to increase java_thread_min_stack_allowed calculation
- Closed
-
JDK-6675312 Linux glibc stack guard-pages can overlap with hotspot guard pages
- Closed
-
JDK-8288631 Avoid applying Linux NPTL stack guard workaround for glibc 2.27+
- Closed
-
JDK-8170655 [posix] Fix minimum stack size computations
- Resolved