[GHC] #6059: FFI: segfault when jumping to code buffer (under certain conditions)

GHC cvs-ghc at haskell.org
Tue May 1 17:42:16 CEST 2012


#6059: FFI: segfault when jumping to code buffer (under certain conditions)
-------------------------------+--------------------------------------------
    Reporter:  guest           |       Owner:               
        Type:  bug             |      Status:  new          
    Priority:  normal          |   Milestone:               
   Component:  Compiler (FFI)  |     Version:  7.4.1        
    Keywords:  segfault ffi    |          Os:  Linux        
Architecture:  x86             |     Failure:  Runtime crash
  Difficulty:  Unknown         |    Testcase:               
   Blockedby:                  |    Blocking:               
     Related:                  |  
-------------------------------+--------------------------------------------
Changes (by simonmar):

  * difficulty:  => Unknown


Comment:

 If I understand correctly, you're asking why the program sometimes works,
 not why it sometimes fails?  It is expected that jumping to ordinary
 memory might crash.

 In the GHC RTS we have a function `allocateExec()` for allocating
 executable memory.  Internally it calls into `libffi` which has all sorts
 of hacks to make this work.

 If you want we could make `allocateExec()` visible from Haskell, though it
 needs an explicit `freeExec()` (you can't allocate garbage-collectable
 executable memory).

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



More information about the Glasgow-haskell-bugs mailing list