[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:"6e96aa2d503ddeeef1fa1f37b45d5c744522b64d/ghc" 6e96aa2/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6e96aa2d503ddeeef1fa1f37b45d5c744522b64d"
 Don't use X86_64_ELF_NONPIC_HACK for +RTS -xp

 Summary:
 When `+RTS -xp` is passed, when don't need the X86_64_ELF_NONPIC_HACK,
 becasue the relocation offset should only be out of range if

 * the object file was not compiled with `-fPIC -fexternal-dynamic-refs`;
 * ghc generates non-pic code while it should (e.g. #15723)

 In either case, we should print an error message rather that silently
 attempt to use a hacky workaround that may not work.

 This could have made debugging #15723 and #15729 much easier.

 Test Plan:
 Run this in a case where ghci used to crash becasue of T15723. Now we
 see helpful message like:

 ```
 ghc-iserv-prof: R_X86_64_PC32 relocation out of range:
 stmzm2zi4zi4zi1zmJQn4hNPyYjP5m9AcbI88Ve_ControlziConcurrentziSTMziTMVar_readTMVar_C61n_cc
 = 9b95ffac
 ```

 Reviewers: simonmar, bgamari, erikd

 Reviewed By: simonmar, bgamari

 Subscribers: rwbarton, carter

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

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


More information about the ghc-tickets mailing list