- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    8, 9, 10, 11, 12, 13, 14
- 
        b21
- 
        linux
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8309539 | 17.0.9-oracle | Poonam Bajaj Parhar | P4 | Resolved | Fixed | b01 | 
| JDK-8310741 | 17.0.9 | Martin Doerr | P4 | Resolved | Fixed | b01 | 
| JDK-8310385 | 11.0.21-oracle | Poonam Bajaj Parhar | P4 | Resolved | Fixed | b01 | 
| JDK-8312879 | 11.0.21 | Lutz Schmidt | P4 | Resolved | Fixed | b01 | 
| JDK-8310499 | 8u391 | Poonam Bajaj Parhar | P4 | Resolved | Fixed | b01 | 
According to glibc bug "guard size is subtracted from thread stack size instead of adding it on top", https://sourceware.org/bugzilla/show_bug.cgi?id=22637:
"Previously if user requested S stack and G guard when creating a thread, the total mapping was S and the actual available stack was S - G - static_tls, which is not what the user requested.
This patch fixes the guard size accounting by pretending the user requested S+G stack. This way all later logic works out except when reporting the user requested stack size (pthread_getattr_np) or when computing the minimal stack size (__pthread_get_minstack)."
With glibc 2.27 and new versions, the allocated thread stack size is user_requested_size+guard_size. Linux os::create_thread() adds an extra guard page size to the requested stack size in the default case:
bool os::create_thread(Thread* thread, ThreadType thr_type,
size_t req_stack_size) {
...
stack_adjust_size += guard_size;
With glibc 2.27 and new versions, the above is no longer needed for the default case.
- backported by
- 
                    JDK-8309539 Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27) -           
- Resolved
 
-         
- 
                    JDK-8310385 Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27) -           
- Resolved
 
-         
- 
                    JDK-8310499 Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27) -           
- Resolved
 
-         
- 
                    JDK-8310741 Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27) -           
- Resolved
 
-         
- 
                    JDK-8312879 Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27) -           
- Resolved
 
-         
- duplicates
- 
                    JDK-8303838 Stack bottom and size computed incorrectly in current_stack_region -           
- Closed
 
-         
- 
                    JDK-8288631 Avoid applying Linux NPTL stack guard workaround for glibc 2.27+ -           
- Closed
 
-         
- links to
- 
                     Commit
        openjdk/jdk11u-dev/b49e8b28 Commit
        openjdk/jdk11u-dev/b49e8b28
- 
                     Commit
        openjdk/jdk17u-dev/832707ba Commit
        openjdk/jdk17u-dev/832707ba
- 
                     Commit
        openjdk/jdk/9ebcda21 Commit
        openjdk/jdk/9ebcda21
- 
                     Review
        openjdk/jdk11u-dev/2035 Review
        openjdk/jdk11u-dev/2035
- 
                     Review
        openjdk/jdk17u-dev/1489 Review
        openjdk/jdk17u-dev/1489
- 
                     Review
        openjdk/jdk/13571 Review
        openjdk/jdk/13571