
#11522: maxStkSize can overflow -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 7.8.4 System | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The `maxStkSize` field of `GC_FLAGS` is a `nat`, or `unsigned int`. It's measured in words, but still 32G is not an unreasonable amount of memory by today's standards. Maybe it's unlikely that anyone would want to set the stack size limit to more than 32G. But if you happen to have just over 40G of physical memory then the default stack size limit will overflow to a value just above zero and then Bad Things would happen. If we want to actually enforce stack limits that are greater than 2^32^ words, we would need to increase the size of the `tot_stack_size` field of a TSO also. Simple test of overflow behavior: `ghci +RTS -K32.0001G` will exit with a stack overflow. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11522 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler