[GHC] #14036: GHCi HEAD segfaults upon startup with a prof build
#14036: GHCi HEAD segfaults upon startup with a prof build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHCi crash Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- After building GHC HEAD using a `mk/build.mk` file with the following settings: {{{ BuildFlavour = prof GhcStage2HcOpts = -O0 $(GhcFAsm) -fprof-auto -DDEBUG }}} I find myself knee-deep in segfault town: {{{ $ inplace/bin/ghc-stage2 --interactive GHCi, version 8.3.20170726: http://www.haskell.org/ghc/ :? for help Segmentation fault (core dumped) }}} Welp. Here's what happens when I run it through `gdb`: {{{ $ gdb inplace/lib/bin/ghc-stage2 GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from inplace/lib/bin/ghc-stage2...done. (gdb) r -B"/u/rgscott/Software/ghc2/inplace/lib" --interactive Starting program: /home/rgscott/Software/ghc2/inplace/lib/bin/ghc-stage2 -B"/u/rgscott/Software/ghc2/inplace/lib" --interactive [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff635e700 (LWP 13161)] [New Thread 0x7ffff5b5d700 (LWP 13162)] [New Thread 0x7ffff535c700 (LWP 13163)] [New Thread 0x7ffff4b5b700 (LWP 13164)] GHCi, version 8.3.20170726: http://www.haskell.org/ghc/ :? for help Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff4b5b700 (LWP 13164)] 0x000000000514ecb3 in interpretBCO (cap=0x64b9fc0 <MainCapability>) at rts/Interpreter.c:743 743 if (get_itbl(UNTAG_CLOSURE(pap->fun))->type != BCO) { }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14036> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14036: GHCi HEAD segfaults upon startup with a prof build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: simonmar (added) Comment: The offending commit is f9c6d53fe997f1c560cda6f346f4b201711df37c (Tag the FUN before making a PAP (#13767)). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14036#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14036: GHCi HEAD segfaults upon startup with a prof build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3983 Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => patch * differential: => Phab:D3983 Comment: I found the problem. {{{#!hs arity <= TAG_MASK ? obj + arity : obj, }}} That addition is ''pointer'' addition, which changes all the wrong bits. We need to cast the `obj` to an integer before adding. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14036#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14036: GHCi HEAD segfaults upon startup with a prof build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3983 Wiki Page: | -------------------------------------+------------------------------------- Comment (by David Feuer <David.Feuer@…>): In [changeset:"60a3f11ff4b7e239a273498812fd9d31f6775726/ghc" 60a3f11f/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="60a3f11ff4b7e239a273498812fd9d31f6775726" Fix pointer tagging mistake f9c6d53fe997f1c560cda6f346f4b201711df37c led to #14036. The problem turned out to be rather simple: the `obj` pointer was being tagged using `obj + arity`. Because this is C, that's done with *pointer arithmetic*, which is not at all what we want. Add appropriate casts. Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14036 Differential Revision: https://phabricator.haskell.org/D3983 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14036#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14036: GHCi HEAD segfaults upon startup with a prof build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3983 Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14036#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14036: GHCi HEAD segfaults upon startup with a prof build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3983 Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * cc: dfeuer (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14036#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC