[GHC] #12690: Segmentation fault in GHC runtime system under low memory with USE_LARGE_ADDRESS_SPACE

GHC ghc-devs at haskell.org
Fri Mar 31 22:45:05 UTC 2017


#12690: Segmentation fault in GHC runtime system under low memory with
USE_LARGE_ADDRESS_SPACE
-----------------------------------+--------------------------------------
        Reporter:  pggiarrusso     |                Owner:  (none)
            Type:  bug             |               Status:  new
        Priority:  high            |            Milestone:
       Component:  Runtime System  |              Version:  8.0.1
      Resolution:                  |             Keywords:
Operating System:  Linux           |         Architecture:  x86_64 (amd64)
 Type of failure:  Runtime crash   |            Test Case:
      Blocked By:                  |             Blocking:
 Related Tickets:                  |  Differential Rev(s):
       Wiki Page:                  |
-----------------------------------+--------------------------------------

Comment (by allbery_b):

 The specific circumstances that would lead to this are:

 - runtime does an `madvise` to request a new page. This returns
 success/fail of the request, but the OS does not actually assign a page
 until it is needed

 - if the page can't actually be allocated at the time of first use (which
 likely means first write to it), the process will be sent `SIGSEGV`

 This is one reason other projects don't use this style of memory
 management any more (somewhat infamously, the original Bourne shell did
 memory allocation this way, but instead of `madvise` --- which didn't
 exist yet --- it just caught the `SIGSEGV` and called `brk` to increase
 the allocated address space). That sort-of worked (except on MC68000; Sun
 had to rewrite the Bourne shell's memory manager) on non-demand paged
 systems, but delayed-until-use allocation on demand paged systems means
 `SEGV` is the only way to know an allocation failed.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12690#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list