Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139864

Improve handling of stack protection zones.



    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • hotspot
    • b103


      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.


        Issue Links



              goetz Goetz Lindenmaier
              goetz Goetz Lindenmaier
              0 Vote for this issue
              4 Start watching this issue