JDK-8139864 : Improve handling of stack protection zones.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-10-19
  • Updated: 2024-11-13
  • Resolved: 2015-12-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b103Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Stacks contain 3 zones used to handle stack overflows: red pages, yellow pages and shadow pages. These are used to detect stack overflow and to reserve space to handle stack overflow. Also, they try to protect from stack overflow in native code.

The sizes of these zones are given in pages. Unfortunately different operating systems have different page sizes, so a fixed number of pages results in different sizes of these zones depending on which system the VM runs. 

This also conflicts with the default stack size, which is given in bytes, not in pages. So the default stack is too small to hold these zones if pages are big. 

Therefore the number of pages for these zones is reduced if a system has default page sizes > 8K (see os_linux.cpp:4648). 

This conflicts with the checking of lower bounds of these flags introduced in JDK-8078556. E.g., on x86, 20 shadow pages are configured, which requires 1280K stack space with 64K pages per default and thus is reduced to round_to(20*8K,64K) / 64K = round_to(32*8K, 64K) / 64K = 4. In the end, 4 64K pages are used for the shadow zone.

Setting StackShadowPages=4 at os_linux.cpp:4648 now violates the lower bound of this flag and causes the VM to abort. 
Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/3125c4a60cc9 User: lana Date: 2016-01-27 21:42:23 +0000
27-01-2016

This fix had some parenthesis issues that were fixed by: JDK-8146751 jdk/test/tools/launcher/TooSmallStackSize.java failed on Mac OS
19-01-2016

URL: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/3125c4a60cc9 User: coleenp Date: 2015-12-21 16:04:55 +0000
21-12-2015