JDK-4134353 : (hpi) sysThreadCheckStack is a no-op on win32
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: x86
  • Submitted: 1998-05-01
  • Updated: 1999-04-09
  • Resolved: 1999-04-09
Related Reports
Duplicate :  
Description
On Win32, sysThreadCheckStack does not really check for stack overflow.  Since
this is possible to do, it should be implemented, otherwise a stack overflow
will not be detected and can a crash.

dean.long@Eng 1998-05-01

Comments
EVALUATION I'll downgrade this to P5 because we are not likely going to fix this for 1.2. The reason is that sysThreadCheckStack is useless with the JIT on anyway. sheng.liang@Eng 1998-07-28
28-07-1998

SUGGESTED FIX This is easy to do if the stack size is known -- just use code similar to the green threads version of this function. If the stack size is unknown because the default stack size was used, I don't think there is a Win32 API to get this number. Therefore I suggest using try-except to check the red zone. Something like the following should work: __try { char dummy[1]; dummy[-RED_ZONE_SIZE] = 0; return 1; } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) { return 0; } If RED_ZONE_SIZE is greater than the page size, then a loop would be good to test each page. This method could also be used to discover and remember the true stack size, once when the tread is created, so that the quick pointer comparison test could always be done. dean.long@Eng 1998-05-01 Using VirtualQuery() on tid->stack_base and looking and AllocationBase like sysThreadStackPointer() does might also be useful for obtaining the stack size. dean.long@Eng 1998-05-01
01-05-1998