Ticket #3685 (closed merge: fixed)

Opened 4 years ago

Last modified 3 years ago

"double free or corruption" error when running Setup.hs with other GHC in PATH

Reported by: ajd Owned by: igloo
Priority: high Milestone: 6.12.1
Component: Compiler Version: 6.11
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: Runtime crash Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Inside network-2.2.1.5 source directory:

$ /home/alex/usr/bin/ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.0.20091121
$ /usr/bin/ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.10.4
$ echo $PATH
/home/alex/.cabal/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core
$ /home/alex/usr/bin/ghc --make Setup.hs 
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )

Setup.hs:3:0:
    Warning: In the use of `defaultUserHooks'
             (imported from Distribution.Simple):
             Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
             compatibility in which case you must stick with defaultUserHooks"
Linking Setup ...
$ ./Setup configure
Warning: defaultUserHooks in Setup script is deprecated.
Configuring network-2.2.1.5...
Setup: fd:5: hGetContents: invalid argument (Invalid or incomplete multibyte or wide character)
*** glibc detected *** ./Setup: double free or corruption (!prev): 0x08e21050 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6b6c1)[0xb76166c1]
/lib/libc.so.6(+0x6cf18)[0xb7617f18]
/lib/libc.so.6(cfree+0x6d)[0xb761af8d]
/lib/libc.so.6(+0x1829c)[0xb75c329c]
/lib/libc.so.6(iconv_close+0x1c)[0xb75c27ec]
./Setup[0x821f6b9]
======= Memory map: ========
08048000-082be000 r-xp 00000000 fe:00 1603797    /home/alex/src/network-2.2.1.5/Setup
082be000-082ed000 rwxp 00275000 fe:00 1603797    /home/alex/src/network-2.2.1.5/Setup
082ed000-082f0000 rwxp 00000000 00:00 0 
08dbf000-08e4a000 rwxp 00000000 00:00 0          [heap]
b6f00000-b6f21000 rwxp 00000000 00:00 0 
b6f21000-b7000000 ---p 00000000 00:00 0 
b70c8000-b70e5000 r-xp 00000000 08:03 385336     /usr/lib/libgcc_s.so.1
b70e5000-b70e6000 rwxp 0001c000 08:03 385336     /usr/lib/libgcc_s.so.1
b7100000-b7300000 rwxp 00000000 00:00 0 
b7391000-b7591000 r-xp 00000000 08:03 396531     /usr/lib/locale/locale-archive
b7591000-b7592000 rwxp 00000000 00:00 0 
b7592000-b75a7000 r-xp 00000000 08:03 262160     /lib/libpthread-2.11.so
b75a7000-b75a8000 r-xp 00014000 08:03 262160     /lib/libpthread-2.11.so
b75a8000-b75a9000 rwxp 00015000 08:03 262160     /lib/libpthread-2.11.so
b75a9000-b75ab000 rwxp 00000000 00:00 0 
b75ab000-b76eb000 r-xp 00000000 08:03 262169     /lib/libc-2.11.so
b76eb000-b76ed000 r-xp 00140000 08:03 262169     /lib/libc-2.11.so
b76ed000-b76ee000 rwxp 00142000 08:03 262169     /lib/libc-2.11.so
b76ee000-b76f1000 rwxp 00000000 00:00 0 
b76f1000-b7715000 r-xp 00000000 08:03 262184     /lib/libm-2.11.so
b7715000-b7716000 r-xp 00023000 08:03 262184     /lib/libm-2.11.so
b7716000-b7717000 rwxp 00024000 08:03 262184     /lib/libm-2.11.so
b7717000-b7718000 rwxp 00000000 00:00 0 
b7718000-b7762000 r-xp 00000000 08:03 388239     /usr/lib/libgmp.so.3.5.0
b7762000-b7765000 rwxp 00049000 08:03 388239     /usr/lib/libgmp.so.3.5.0
b7765000-b7767000 r-xp 00000000 08:03 262188     /lib/libdl-2.11.so
b7767000-b7768000 r-xp 00001000 08:03 262188     /lib/libdl-2.11.so
b7768000-b7769000 rwxp 00002000 08:03 262188     /lib/libdl-2.11.so
b7769000-b776b000 r-xp 00000000 08:03 262274     /lib/libutil-2.11.so
b776b000-b776c000 r-xp 00001000 08:03 262274     /lib/libutil-2.11.so
b776c000-b776d000 rwxp 00002000 08:03 262274     /lib/libutil-2.11.so
b776d000-b7774000 r-xp 00000000 08:03 262277     /lib/librt-2.11.so
b7774000-b7775000 r-xp 00006000 08:03 262277     /lib/librt-2.11.so
b7775000-b7776000 rwxp 00007000 08:03 262277     /lib/librt-2.11.so
b778c000-b778e000 r-xp 00000000 08:03 184559     /usr/lib/gconv/UTF-32.so
b778e000-b778f000 r-xp 00001000 08:03 184559     /usr/lib/gconv/UTF-32.so
b778f000-b7790000 rwxp 00002000 08:03 184559     /usr/lib/gconv/UTF-32.so
b7790000-b7791000 rwxp 00000000 00:00 0 
b7791000-b7792000 r-xp 00000000 00:00 0          [vdso]
b7792000-b77ae000 r-xp 00000000 08:03 262276     /lib/ld-2.11.so
b77ae000-b77af000 r-xp 0001b000 08:03 262276     /lib/ld-2.11.so
b77af000-b77b0000 rwxp 0001c000 08:03 262276     /lib/ld-2.11.so
bffe2000-bfff7000 rwxp 00000000 00:00 0          [stack]
Aborted

Basically, a Setup script compiled with a different GHC than the one that Setup is using fails with a memory error.

See attached file for /usr/bin/ghc-pkg dump output.

Change History

Changed 3 years ago by simonmar

  • owner set to igloo
  • priority changed from normal to high
  • type changed from bug to merge
  • milestone set to 6.12.1

Fixed

Wed Nov 25 04:34:35 PST 2009  Simon Marlow <marlowsd@gmail.com>
  * hGetContents: close the handle properly on error
  Ignore-this: bc37ff678acc6e547dc390285e056eb9
  
  When hGetContents caught an error it was closing the handle and then
  throwing the exception, without updating the handle with the new
  closed state.  This lead to a double-closed, which was the cause of
  
  *** glibc detected *** ./Setup: double free or corruption 
  
  when iconv_close was called twice on the decoder.
  
  See http://hackage.haskell.org/trac/hackage/ticket/609

    M ./GHC/IO/Handle/Text.hs -5 +9

Changed 3 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Merged

Note: See TracTickets for help on using tickets.