[GHC] #15729: Static GHCi can segfault when accessing .bss section in C

GHC ghc-devs at haskell.org
Mon Mar 4 18:51:00 UTC 2019


#15729: Static GHCi can segfault when accessing .bss section in C
-------------------------------+--------------------------------------
        Reporter:  watashi     |                Owner:  watashi
            Type:  bug         |               Status:  closed
        Priority:  normal      |            Milestone:  8.8.1
       Component:  GHCi        |              Version:  8.6.1
      Resolution:  fixed       |             Keywords:
Operating System:  Linux       |         Architecture:  x86_64 (amd64)
 Type of failure:  GHCi crash  |            Test Case:
      Blocked By:              |             Blocking:
 Related Tickets:  #781        |  Differential Rev(s):  Phab:D5219
       Wiki Page:              |
-------------------------------+--------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"740534d43cf9f1635c60f6311b7e0d89af962617/ghc" 740534d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="740534d43cf9f1635c60f6311b7e0d89af962617"
 Allocate bss section within proper range of other sections

 Summary:
 This re-applies {D5195} and {D5235}, they were reverted as part of diff
 stack to unbreak i386. The proper fix is done in {D5289}.

 Allocate bss section within proper range of other sections:

 * when `+RTS -xp` is passed, allocate it contiguously as we did for
   jump islands
 * when we mmap the code to lower 2Gb, we should allocate bss section
   there too

 Test Plan:
 1. `./validate`

 2.

 with

 ```
 DYNAMIC_GHC_PROGRAMS = NO
 DYNAMIC_BY_DEFAULT = NO
 ```

 `TEST="T15729" make test` passed in both linux (both i386 and x86_64) and
 macos.

 3.

 Also test in a use case where we used to encouter error like:

 ```
 ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) =
 b90282ba
 ```

 and now, everything works fine.

 Reviewers: simonmar, bgamari, angerman, erikd

 Reviewed By: simonmar

 Subscribers: rwbarton, carter

 GHC Trac Issues: #15729

 Differential Revision: https://phabricator.haskell.org/D5290
 }}}

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


More information about the ghc-tickets mailing list