[GHC] #11522: maxStkSize can overflow

#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

#11522: maxStkSize can overflow -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.4 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * cc: MarcelineVQ (added) Comment: MarcelineVQ: maybe you can have a look at this one as well, while you're working on #11502. Don't forget a test. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11522#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11522: maxStkSize can overflow -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: MarcelineVQ Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.4 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1895 Wiki Page: | -------------------------------------+------------------------------------- Changes (by MarcelineVQ): * owner: => MarcelineVQ * differential: => Phab:D1895 Comment: The suggested overflow test of -K32.0001G can overflow enough to be above the minimally required stack size to run a small program. Decided to use -K4294967297W to overflow it to exactly 1 for testing. According to the invariants in TSO.h:[[BR]] tso->stack_size <= tso->max_stack_size[[BR]] Which means I'll need to change StgStack.stack_size too but its implications reach farther than the other two, offsets and such, so please double-check if that's a good idea. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11522#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11522: maxStkSize can overflow -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.4 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1895 Wiki Page: | -------------------------------------+------------------------------------- Changes (by MarcelineVQ): * owner: MarcelineVQ => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11522#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC