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

[Windows] Guard zone should use PAGE_NOACCESS instead of PAGE_GUARD

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 24
    • hotspot
    • windows

      While working on JDK-8335362 I found that the way we create the "guard zone" (red zone + yellow zone + reserved zone) doesn't seem correct on Windows. These pages are guarded using VirtualProtect() with PAGE_GUARD as memory protection attribute (see StackOverflow::create_stack_guard_pages()). But from testing I checked that accessing a page with this protection attribute will be handled directly by the OS as explained in JDK-8335362, and not by our signal handler. The reason why it's currently working is because it seems that Windows checks there are at least 4 pages below the current guarded one and if not we get an EXCEPTION_STACK_OVERFLOW exception. Currently for Windows DEFAULT_STACK_RED_PAGES=1, DEFAULT_STACK_YELLOW_PAGES=3, and DEFAULT_STACK_RESERVED_PAGES=0. So if we access the first page of the guard zone, below it there will only be 3 more pages, so we do get an EXCEPTION_STACK_OVERFLOW. But increasing the sizes of this zones makes touching the top page of the guard zone unnoticeable.

            Unassigned Unassigned
            pchilanomate Patricio Chilano Mateo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: