[GHC] #16186: Segfault when embedding data via file-embed.
GHC
ghc-devs at haskell.org
Tue Jan 15 14:39:32 UTC 2019
#16186: Segfault when embedding data via file-embed.
---------------------------------+----------------------------------------
Reporter: syd | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.4.3
Resolution: | Keywords:
Operating System: Linux | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
---------------------------------+----------------------------------------
Description changed by syd:
Old description:
> I made a minimal reproducible-ish example here:
>
> https://github.com/NorfairKing/nix-segfault-haskell
>
> and described it at length here:
>
> https://github.com/NixOS/nixpkgs/issues/52439#issuecomment-453872693
>
> The problem seems to occur (randomly) when literal strings are embedded
> via TH.
> By the way: to embed about 10MiB of data, 12 cores are being used at 100%
> which seems mildly absurd.
New description:
GHC segfaults when embedding a bunch of data via `file-embed`:
{{{
/nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-ghc-8.4.3/bin/ghc --make
-fbuilding-cabal-package -O -static -dynamic-too -dynosuf dyn_o -dynhisuf
dyn_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir
dist/build -i -idist/build -isrc -idist/build/autogen -idist/build/global-
autogen -Idist/build/autogen -Idist/build/global-autogen -Idist/build
-optP-include -optPdist/build/autogen/cabal_macros.h -this-unit-id
segfault-0.0.0-G2YKYaaGIenGdA1YODfaB0 -hide-all-packages -Wmissing-home-
modules -no-user-package-db -package-db /tmp/nix-build-
segfault-0.0.0.drv-2/package.conf.d -package-db dist/package.conf.inplace
-package-id base-4.11.1.0 -package-id bytestring-0.10.8.2 -package-id
file-embed-0.0.10.1-JBj0CTa3b3pL2aTV19QFZK -XHaskell2010 Lib
Paths_segfault -j12 -split-sections
[2 of 2] Compiling Lib ( src/Lib.hs, dist/build/Lib.o )
Segmentation fault (core dumped)
}}}
I made a minimal reproducible-ish example here:
https://github.com/NorfairKing/nix-segfault-haskell
and described it at length here:
https://github.com/NixOS/nixpkgs/issues/52439#issuecomment-453872693
The problem seems to occur (randomly) when literal strings are embedded
via TH.
By the way: to embed about 10MiB of data, 12 cores are being used at 100%
which seems mildly absurd.
It is relatively easy to obtain a core-dump file for it, and then we see
the following in `gdb`:
{{{
$ /usr/sbin/gdb /nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-
ghc-8.4.3/lib/ghc-8.4.3/bin/ghc core.3212
GNU gdb (GDB) 8.2.1
Copyright (C) 2018 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-pc-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 /nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-
ghc-8.4.3/lib/ghc-8.4.3/bin/ghc...(no debugging symbols found)...done.
[New LWP 3232]
[New LWP 3244]
[New LWP 3252]
[New LWP 3230]
[New LWP 3231]
[New LWP 3212]
[New LWP 3213]
[New LWP 3242]
[New LWP 3226]
[New LWP 3227]
[New LWP 3233]
[New LWP 3251]
[New LWP 3225]
[New LWP 3241]
[New LWP 3245]
[New LWP 3224]
[New LWP 3214]
[New LWP 3237]
[New LWP 3235]
[New LWP 3215]
[New LWP 3238]
[New LWP 3216]
[New LWP 3248]
[New LWP 3253]
[New LWP 3234]
[New LWP 3266]
[New LWP 3239]
[New LWP 3247]
[New LWP 3250]
[New LWP 3249]
[New LWP 3240]
[New LWP 3228]
[New LWP 3229]
[New LWP 3246]
[New LWP 3236]
[New LWP 3243]
warning: File "/nix/store/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-
glibc-2.27/lib/libthread_db-1.0.so" auto-loading has been declined by your
`auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /nix/store
/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libthread_db-1.0.so
line to your configuration file "/homeless-shelter/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/homeless-shelter/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the
shell:
info "(gdb)Auto-loading safe path"
warning: Unable to find libthread_db matching inferior's thread library,
thread debugging will not be available.
warning: File "/nix/store/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-
glibc-2.27/lib/libthread_db-1.0.so" auto-loading has been declined by your
`auto-load safe-path' set to "$debugdir:$datadir/auto-load".
warning: Unable to find libthread_db matching inferior's thread library,
thread debugging will not be available.
Core was generated by `/nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-
ghc-8.4.3/lib/ghc-8.4.3/bin/ghc -B/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fad21c9ae9f in abort () from /nix/store
/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6
[Current thread is 1 (LWP 3232)]
(gdb) bt
#0 0x00007fad21c9ae9f in abort () from /nix/store
/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6
#1 0x00007fad21cdb2ac in __libc_message () from /nix/store
/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6
#2 0x00007fad21cdb2ce in __libc_fatal () from /nix/store
/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6
#3 0x00007fad21a536a6 in pthread_cond_wait@@GLIBC_2.3.2 ()
from /nix/store/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-
glibc-2.27/lib/libpthread.so.0
#4 0x00007fad22d7fdd9 in waitCondition ()
from /nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-
ghc-8.4.3/lib/ghc-8.4.3/bin/../rts/libHSrts_thr-ghc8.4.3.so
#5 0x00007fad22d6243b in yieldCapability ()
from /nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-
ghc-8.4.3/lib/ghc-8.4.3/bin/../rts/libHSrts_thr-ghc8.4.3.so
#6 0x00007fad22d66e23 in schedule ()
from /nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-
ghc-8.4.3/lib/ghc-8.4.3/bin/../rts/libHSrts_thr-ghc8.4.3.so
#7 0x00007fad22d6868c in scheduleWorker ()
from /nix/store/6j6slxdhbbzxvhkn6yf7afm62r8n9fmf-
ghc-8.4.3/lib/ghc-8.4.3/bin/../rts/libHSrts_thr-ghc8.4.3.so
#8 0x00007fad21a4d5a7 in start_thread () from /nix/store
/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libpthread.so.0
#9 0x00007fad21d5722f in clone () from /nix/store
/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6
}}}
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16186#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list