GHCi 9.4.4 segfault when loading asl-translator
GHCi (as invoked through cabal repl
) can segfault with GHC 9.4.4 when invoked on the asl-translator
library. To reproduce:
$ git clone https://github.com/GaloisInc/asl-translator && cd asl-translator/
$ git checkout cabal-repl-segfault
$ git submodule update --init
$ ln -s cabal.project.newbuild cabal.project
$ cabal repl -w ghc-9.4.4
This will eventually segfault:
$ cabal repl -w ghc-9.4.4
Build profile: -w ghc-9.4.4 -O1
In order, the following will be built (use -v for more details):
- asl-translator-0.1.0.0 (lib) (first run)
Preprocessing library for asl-translator-0.1.0.0..
GHCi, version 9.4.4: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/ryanglscott/.ghci
[ 1 of 26] Compiling Data.Parameterized.CtxFuns ( lib/Data/Parameterized/CtxFuns.hs, interpreted )
[ 2 of 26] Compiling Data.Parameterized.AssignTree ( lib/Data/Parameterized/AssignTree.hs, interpreted )
[ 3 of 26] Compiling Data.Parameterized.SomeSome ( lib/Data/Parameterized/SomeSome.hs, interpreted )
[ 4 of 26] Compiling Language.ASL.Crucible.Exceptions ( lib/Language/ASL/Crucible/Exceptions.hs, interpreted )
[ 5 of 26] Compiling Language.ASL.Formulas.Attach ( lib/Language/ASL/Formulas/Attach.hs, interpreted )
[ 6 of 26] Compiling Language.ASL.Formulas.Serialize ( lib/Language/ASL/Formulas/Serialize.hs, interpreted )
[ 7 of 26] Compiling Language.ASL.Types ( lib/Language/ASL/Types.hs, interpreted )
[ 8 of 26] Compiling Language.ASL.Globals.Types ( lib/Language/ASL/Globals/Types.hs, interpreted )
[ 9 of 26] Compiling Paths_asl_translator ( /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build/autogen/Paths_asl_translator.hs, interpreted )
[10 of 26] Compiling Language.ASL.Formulas ( lib/Language/ASL/Formulas.hs, interpreted )
[11 of 26] Compiling Util.Log ( lib/Util/Log.hs, interpreted )
[12 of 26] Compiling Language.ASL.SyntaxTraverse ( lib/Language/ASL/SyntaxTraverse.hs, interpreted )
[13 of 26] Compiling Language.ASL.StaticExpr ( lib/Language/ASL/StaticExpr.hs, interpreted )
[14 of 26] Compiling Language.ASL.Signature ( lib/Language/ASL/Signature.hs, interpreted )
[15 of 26] Compiling Language.ASL.Translation.Exceptions ( lib/Language/ASL/Translation/Exceptions.hs, interpreted )
[16 of 26] Compiling Language.ASL.Crucible.Extension ( lib/Language/ASL/Crucible/Extension.hs, interpreted )
[17 of 26] Compiling Language.ASL.Globals.Definitions ( lib/Language/ASL/Globals/Definitions.hs, interpreted )
[18 of 26] Compiling Language.ASL.Globals ( lib/Language/ASL/Globals.hs, interpreted )
[19 of 26] Compiling Language.ASL.Translation.Preprocess ( lib/Language/ASL/Translation/Preprocess.hs, interpreted )
[20 of 26] Compiling Language.ASL.Translation ( lib/Language/ASL/Translation.hs, interpreted )
[21 of 26] Compiling Language.ASL.Globals.ConsistencyCheck ( lib/Language/ASL/Globals/ConsistencyCheck.hs, interpreted )
Globals consistency check passed.
[22 of 26] Compiling Language.ASL.Crucible ( lib/Language/ASL/Crucible.hs, interpreted )
[23 of 26] Compiling Language.ASL ( lib/Language/ASL.hs, interpreted )
[24 of 26] Compiling What4.Expr.ExprTree ( lib/What4/Expr/ExprTree.hs, interpreted )
[25 of 26] Compiling Language.ASL.Formulas.Normalize ( lib/Language/ASL/Formulas/Normalize.hs, interpreted )
Error: cabal: repl failed for asl-translator-0.1.0.0. The build process
segfaulted (i.e. SIGSEGV).
The exact location of the segfault is somewhat nondeterministic, but it does segfault fairly reliably. If I load the GHCi command that cabal repl
uses into gdb
, here is the backtrace that I get:
(gdb) r
Starting program: /home/ryanglscott/.ghcup/ghc/9.4.4/lib/ghc-9.4.4/bin/ghc-9.4.4 -B/home/ryanglscott/.ghcup/ghc/9.4.4/lib/ghc-9.4.4/lib --interactive -fbuilding-cabal-package -O0 -outputdir /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build -odir /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build -hidir /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build -stubdir /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build -i -i/home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build -ilib -i/home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build/autogen -i/home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build/global-autogen -I/home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build/autogen -I/home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build/global-autogen -I/home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build -optP-DUNSAFE_OPS -optP-include -optP/home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build/autogen/cabal_macros.h -this-unit-id asl-translator-0.1.0.0-inplace -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /home/ryanglscott/.cabal/store/ghc-9.4.4/package.db -package-db /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/packagedb/ghc-9.4.4 -package-db /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/package.conf.inplace -package-id asl-parser-0.1.0.0-inplace -package-id base-4.17.0.0 -package-id bimap-0.5.0-3b15adda40d4922b46c85076cf11369c03274438eb0359027a2434a2d2edd653 -package-id bv-sized-1.0.5-f17825e2874d236830abebde418f7b72a4774e505cf78248e8a7e9b41d2e1064 -package-id bytestring-0.11.3.1 -package-id constraints-0.13.4-a9b8de62844560532ee38a46973dea5a26f2efbb61364fc5c2ddb27322cfff52 -package-id containers-0.6.6 -package-id crucible-0.6-inplace -package-id directory-1.3.7.1 -package-id dismantle-arm-xml-0.1.0.0-inplace -package-id dismantle-tablegen-0.1.0.0-inplace -package-id filepath-1.4.2.2 -package-id hashtables-1.3.1-8d533a8bc96c226c6a43cedc70a9b4ef1b643180fe18e6e04332f9b5a5f5e996 -package-id ilist-0.3.1.0-6f42c3f1b3d731eaabf90f776f807ea8e2a540d287a5a1bca2b8450e1c6b214d -package-id integer-logarithms-1.0.3.1-618ebf7c0d76b1ec7b0b074924d94de36f135e3b7d3a4e6c9eb71462855ccfe9 -package-id lens-5.2.2-80e4922b0bee2814d2ab07afae5c9faa4f804b8e9686f68ed37a3ea2b97259f0 -package-id mtl-2.2.2 -package-id ordered-containers-0.2.3-8c94e06e333e9bd5ee07233242fb14e0875c0eacd2632294b3e4df6ae1b37252 -package-id panic-0.4.0.1-521f633e3a59ef27711a5e6dbc97cfe583471f760788a62531cabac0cd06db6d -package-id parameterized-utils-2.1.6.0-3a943e5a6f1741aec74c0ee5270e433827b1d7930ceca347eb6e4475848fcbe0 -package-id pretty-1.1.3.6 -package-id prettyprinter-1.7.1-8966f7b39b126d3e6f23d7914649ea33b634b07705b4f7f4e0ca6c0273a7b1e1 -package-id s-cargot-0.1.5.0-05c503815f8a951225a70859c03ab6d507830db8de509e1fc134849051c41740 -package-id split-0.2.3.5-664cbef9d9510ef46c911401b98fe75ad86fdb2be72b13d114d0f7b35fa4f858 -package-id template-haskell-2.19.0.0 -package-id text-2.0.1 -package-id th-compat-0.1.4-92fbb1b1d68867a00b991509e9f99b4c2cdb11c25483de43688b2a4817292aba -package-id time-1.12.2 -package-id transformers-0.5.6.2 -package-id unliftio-core-0.2.1.0-6de77af027be946d76cd07c9970717ae828984b83829a82f3ba640e41f191b02 -package-id vector-0.13.0.0-4b8db3c68269623013c3dfb3c43bc2f75bae6ebf6f4324d50e35712f9995c0d1 -package-id what4-1.4.0.0.99-inplace -package-id zlib-0.6.3.0-7ea06883421c776c2de6a75fab769898002985f65fddb96d9caa7a11f23158a6 -XHaskell2010 Language.ASL Language.ASL.Crucible Language.ASL.Crucible.Extension Language.ASL.Crucible.Exceptions Language.ASL.Signature Language.ASL.Translation Language.ASL.Translation.Preprocess Language.ASL.Translation.Driver Language.ASL.Translation.Exceptions Language.ASL.SyntaxTraverse Language.ASL.Types Language.ASL.Formulas.Serialize Language.ASL.Formulas.Normalize Language.ASL.StaticExpr Language.ASL.Globals Language.ASL.Globals.Types Language.ASL.Globals.Definitions Language.ASL.Globals.ConsistencyCheck Data.Parameterized.CtxFuns Data.Parameterized.AssignTree Data.Parameterized.SomeSome Language.ASL.Formulas.Attach Language.ASL.Formulas Util.Log What4.Expr.ExprTree Paths_asl_translator -Wcompat -Wall -hide-all-packages
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffef107700 (LWP 684162)]
[New Thread 0x7fffee906700 (LWP 684163)]
[New Thread 0x7fffee105700 (LWP 684164)]
[New Thread 0x7fffed904700 (LWP 684165)]
GHCi, version 9.4.4: https://www.haskell.org/ghc/ :? for help
[Detaching after vfork from child process 684166]
[Detaching after vfork from child process 684167]
[Detaching after vfork from child process 684168]
[Detaching after vfork from child process 684169]
[Detaching after vfork from child process 684170]
[Detaching after vfork from child process 684171]
[Detaching after vfork from child process 684172]
[Detaching after vfork from child process 684173]
Loaded GHCi configuration from /home/ryanglscott/.ghci
[Detaching after vfork from child process 684174]
[Detaching after vfork from child process 684176]
[Detaching after vfork from child process 684178]
[Detaching after vfork from child process 684180]
[Detaching after vfork from child process 684182]
[Detaching after vfork from child process 684184]
[Detaching after vfork from child process 684186]
[New Thread 0x7fffd9660700 (LWP 684188)]
[ 1 of 26] Compiling Data.Parameterized.CtxFuns ( lib/Data/Parameterized/CtxFuns.hs, interpreted )
[ 2 of 26] Compiling Data.Parameterized.AssignTree ( lib/Data/Parameterized/AssignTree.hs, interpreted )
[ 3 of 26] Compiling Data.Parameterized.SomeSome ( lib/Data/Parameterized/SomeSome.hs, interpreted )
[ 4 of 26] Compiling Language.ASL.Crucible.Exceptions ( lib/Language/ASL/Crucible/Exceptions.hs, interpreted )
[ 5 of 26] Compiling Language.ASL.Formulas.Attach ( lib/Language/ASL/Formulas/Attach.hs, interpreted )
[ 6 of 26] Compiling Language.ASL.Formulas.Serialize ( lib/Language/ASL/Formulas/Serialize.hs, interpreted )
[ 7 of 26] Compiling Language.ASL.Types ( lib/Language/ASL/Types.hs, interpreted )
[ 8 of 26] Compiling Language.ASL.Globals.Types ( lib/Language/ASL/Globals/Types.hs, interpreted )
[ 9 of 26] Compiling Paths_asl_translator ( /home/ryanglscott/Documents/Hacking/Haskell/asl-translator/dist-newstyle/build/x86_64-linux/ghc-9.4.4/asl-translator-0.1.0.0/build/autogen/Paths_asl_translator.hs, interpreted )
[10 of 26] Compiling Language.ASL.Formulas ( lib/Language/ASL/Formulas.hs, interpreted )
[11 of 26] Compiling Util.Log ( lib/Util/Log.hs, interpreted )
[12 of 26] Compiling Language.ASL.SyntaxTraverse ( lib/Language/ASL/SyntaxTraverse.hs, interpreted )
[13 of 26] Compiling Language.ASL.StaticExpr ( lib/Language/ASL/StaticExpr.hs, interpreted )
[14 of 26] Compiling Language.ASL.Signature ( lib/Language/ASL/Signature.hs, interpreted )
[15 of 26] Compiling Language.ASL.Translation.Exceptions ( lib/Language/ASL/Translation/Exceptions.hs, interpreted )
[16 of 26] Compiling Language.ASL.Crucible.Extension ( lib/Language/ASL/Crucible/Extension.hs, interpreted )
[17 of 26] Compiling Language.ASL.Globals.Definitions ( lib/Language/ASL/Globals/Definitions.hs, interpreted )
[18 of 26] Compiling Language.ASL.Globals ( lib/Language/ASL/Globals.hs, interpreted )
[19 of 26] Compiling Language.ASL.Translation.Preprocess ( lib/Language/ASL/Translation/Preprocess.hs, interpreted )
[20 of 26] Compiling Language.ASL.Translation ( lib/Language/ASL/Translation.hs, interpreted )
[21 of 26] Compiling Language.ASL.Globals.ConsistencyCheck ( lib/Language/ASL/Globals/ConsistencyCheck.hs, interpreted )
Globals consistency check passed.
[22 of 26] Compiling Language.ASL.Crucible ( lib/Language/ASL/Crucible.hs, interpreted )
[23 of 26] Compiling Language.ASL ( lib/Language/ASL.hs, interpreted )
[24 of 26] Compiling What4.Expr.ExprTree ( lib/What4/Expr/ExprTree.hs, interpreted )
[25 of 26] Compiling Language.ASL.Formulas.Normalize ( lib/Language/ASL/Formulas/Normalize.hs, interpreted )
Thread 5 "ghc-9.4.4:w" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffed904700 (LWP 684165)]
evacuate1 (p=p@entry=0x425a2d6e00) at rts/sm/Evac.c:704
704 rts/sm/Evac.c: No such file or directory.
(gdb) bt
#0 evacuate1 (p=p@entry=0x425a2d6e00) at rts/sm/Evac.c:704
#1 0x00007fffefd95ef4 in scavenge_block1 (bd=0x425a203580) at rts/sm/Scav.c:601
#2 0x00007fffefdda291 in scavenge_find_work () at rts/sm/Scav.c:2131
#3 scavenge_loop1 () at rts/sm/Scav.c:2178
#4 0x00007fffefdd052a in scavenge_until_all_done () at rts/sm/GC.c:1317
#5 0x00007fffefdd1e32 in GarbageCollect (collect_gen=<optimized out>, collect_gen@entry=1,
do_heap_census=do_heap_census@entry=false, is_overflow_gc=is_overflow_gc@entry=true,
deadlock_detect=deadlock_detect@entry=false, gc_type=gc_type@entry=2, cap=cap@entry=0x5e2050, idle_cap=<optimized out>)
at rts/sm/GC.c:552
#6 0x00007fffefdb56f9 in scheduleDoGC (pcap=pcap@entry=0x7fffed903e70, task=task@entry=0x5fa060,
force_major=force_major@entry=false, is_overflow_gc=<optimized out>, deadlock_detect=deadlock_detect@entry=false)
at rts/Schedule.c:1859
#7 0x00007fffefdb64c5 in schedule (initialCapability=initialCapability@entry=0x7fffefe181c0 <MainCapability>,
task=task@entry=0x5fa060) at rts/Schedule.c:580
#8 0x00007fffefdb7b4c in scheduleWorker (cap=cap@entry=0x7fffefe181c0 <MainCapability>, task=task@entry=0x5fa060)
at rts/Schedule.c:2644
#9 0x00007fffefdbc707 in workerStart (task=0x5fa060) at rts/Task.c:444
#10 0x00007fffefcfe609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007fffefb9d133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(I apologize for the very non-minimal reproducer, as I haven't found a way to minimize this.)
I am using 64-bit Ubuntu 20.04, in case that is important.