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

Improve handling of stack protection zones.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b103

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                goetz Goetz Lindenmaier
                Reporter:
                goetz Goetz Lindenmaier
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: