Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Simon Marlow's avatar
    e3c55aeb
    replace stgMallocBytesRWX() with our own allocator · e3c55aeb
    Simon Marlow authored
    See bug #738
    
    Allocating executable memory is getting more difficult these days.  In
    particular, the default SELinux policy on Fedora Core 5 disallows
    making the heap (i.e. malloc()'d memory) executable, although it does
    apparently allow mmap()'ing anonymous executable memory by default.
    
    Previously, stgMallocBytesRWX() used malloc() underneath, and then
    tried to make the page holding the memory executable.  This was rather
    hacky and fails with Fedora Core 5.  
    
    This patch adds a mini-allocator for executable memory, based on the
    block allocator.  We grab page-sized blocks and make them executable,
    then allocate small objects from the page.  There's a simple free
    function, that will free whole pages back to the system when they are
    empty.
    e3c55aeb
    History
    replace stgMallocBytesRWX() with our own allocator
    Simon Marlow authored
    See bug #738
    
    Allocating executable memory is getting more difficult these days.  In
    particular, the default SELinux policy on Fedora Core 5 disallows
    making the heap (i.e. malloc()'d memory) executable, although it does
    apparently allow mmap()'ing anonymous executable memory by default.
    
    Previously, stgMallocBytesRWX() used malloc() underneath, and then
    tried to make the page holding the memory executable.  This was rather
    hacky and fails with Fedora Core 5.  
    
    This patch adds a mini-allocator for executable memory, based on the
    block allocator.  We grab page-sized blocks and make them executable,
    then allocate small objects from the page.  There's a simple free
    function, that will free whole pages back to the system when they are
    empty.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.