ocaml-community / utop

Universal toplevel for OCaml
Other
849 stars 113 forks source link

Aborted after double free or corruption #336

Closed Tuplanolla closed 4 years ago

Tuplanolla commented 4 years ago

I can consistently crash the interpreter as follows.

$ utop -init /dev/null
─────────────────────┬─────────────────────────────────────────────────────────────┬──────────────────────
                     │ Welcome to utop version 2.6.0 (using OCaml version 4.07.1)! │
                     └─────────────────────────────────────────────────────────────┘

Type #utop_help for help about using utop.

─( 18:00:00 )─< command 0 >────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # open Sys ;;
─( 18:00:01 )─< command 1 >────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # open Unix ;;
─( 18:00:02 )─< command 2 >────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # set_signal sigcont (Signal_handle (fun _ -> raise Division_by_zero)) ;;
- : unit = ()
─( 18:00:03 )─< command 3 >────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # kill (getpid ()) sigstop ;;

[1]+  Stopped                 utop -init /dev/null
$ fg
utop -init /dev/null
*** Error in `/home/tuplanolla/.opam/default/bin/ocamlrun': double free or corruption (fasttop): 0x0000000001ac3040 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x816b9)[0x7f5493f516b9]
/home/tuplanolla/.opam/default/bin/ocamlrun(caml_static_free+0x9)[0x41e7d9]
/home/tuplanolla/.opam/default/bin/ocamlrun(caml_interprete+0x106a)[0x42796a]
/home/tuplanolla/.opam/default/bin/ocamlrun(caml_main+0x1fd)[0x4299ad]
/home/tuplanolla/.opam/default/bin/ocamlrun(main+0xc)[0x40d79c]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f5493ef2545]
/home/tuplanolla/.opam/default/bin/ocamlrun[0x40d7d6]
======= Memory map: ========
00400000-0043b000 r-xp 00000000 fd:09 209912139                          /home/tuplanolla/.opam/default/bin/ocamlrun
0063a000-0063b000 r--p 0003a000 fd:09 209912139                          /home/tuplanolla/.opam/default/bin/ocamlrun
0063b000-0063e000 rw-p 0003b000 fd:09 209912139                          /home/tuplanolla/.opam/default/bin/ocamlrun
0063e000-00660000 rw-p 00000000 00:00 0
01aba000-01c60000 rw-p 00000000 00:00 0                                  [heap]
7f5484000000-7f5484021000 rw-p 00000000 00:00 0
7f5484021000-7f5488000000 ---p 00000000 00:00 0
7f548b121000-7f548b136000 r-xp 00000000 fd:02 20242453                   /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f548b136000-7f548b335000 ---p 00015000 fd:02 20242453                   /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f548b335000-7f548b336000 r--p 00014000 fd:02 20242453                   /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f548b336000-7f548b337000 rw-p 00015000 fd:02 20242453                   /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f548b337000-7f548b67d000 rw-p 00000000 00:00 0
7f548b67d000-7f548b67e000 ---p 00000000 00:00 0
7f548b67e000-7f548be7e000 rw-p 00000000 00:00 0
7f548be7e000-7f548be7f000 ---p 00000000 00:00 0
7f548be7f000-7f548c67f000 rw-p 00000000 00:00 0
7f548c67f000-7f5492ba9000 r--p 00000000 fd:02 51694253                   /usr/lib/locale/locale-archive
7f5492ba9000-7f5492bab000 r-xp 00000000 fd:09 177324823                  /home/tuplanolla/.opam/default/lib/stublibs/dlllambda_term_stubs.so
7f5492bab000-7f5492daa000 ---p 00002000 fd:09 177324823                  /home/tuplanolla/.opam/default/lib/stublibs/dlllambda_term_stubs.so
7f5492daa000-7f5492dab000 r--p 00001000 fd:09 177324823                  /home/tuplanolla/.opam/default/lib/stublibs/dlllambda_term_stubs.so
7f5492dab000-7f5492dac000 rw-p 00002000 fd:09 177324823                  /home/tuplanolla/.opam/default/lib/stublibs/dlllambda_term_stubs.so
7f5492dac000-7f5492dbf000 r-xp 00000000 fd:09 177245444                  /home/tuplanolla/.opam/default/lib/stublibs/dlllwt_unix_stubs.so
7f5492dbf000-7f5492fbe000 ---p 00013000 fd:09 177245444                  /home/tuplanolla/.opam/default/lib/stublibs/dlllwt_unix_stubs.so
7f5492fbe000-7f5492fbf000 r--p 00012000 fd:09 177245444                  /home/tuplanolla/.opam/default/lib/stublibs/dlllwt_unix_stubs.so
7f5492fbf000-7f5492fc0000 rw-p 00013000 fd:09 177245444                  /home/tuplanolla/.opam/default/lib/stublibs/dlllwt_unix_stubs.so
7f5492fc0000-7f5492fc5000 r-xp 00000000 fd:09 59164301                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllthreads.so
7f5492fc5000-7f54931c4000 ---p 00005000 fd:09 59164301                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllthreads.so
7f54931c4000-7f54931c5000 r--p 00004000 fd:09 59164301                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllthreads.so
7f54931c5000-7f54931c6000 rw-p 00005000 fd:09 59164301                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllthreads.so
7f54931c6000-7f54931c8000 r-xp 00000000 fd:09 59164299                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllbigarray.so
7f54931c8000-7f54933c7000 ---p 00002000 fd:09 59164299                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllbigarray.so
7f54933c7000-7f54933c8000 r--p 00001000 fd:09 59164299                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllbigarray.so
7f54933c8000-7f54933c9000 rw-p 00002000 fd:09 59164299                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllbigarray.so
7f54933c9000-7f54933d8000 r-xp 00000000 fd:09 59164297                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllunix.so
7f54933d8000-7f54935d7000 ---p 0000f000 fd:09 59164297                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllunix.so
7f54935d7000-7f54935d8000 r--p 0000e000 fd:09 59164297                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllunix.so
7f54935d8000-7f54935d9000 rw-p 0000f000 fd:09 59164297                   /home/tuplanolla/.opam/default/lib/ocaml/stublibs/dllunix.so
7f54935d9000-7f5493ed0000 rw-p 00000000 00:00 0
7f5493ed0000-7f5494093000 r-xp 00000000 fd:02 16802195                   /usr/lib64/libc-2.17.so
7f5494093000-7f5494293000 ---p 001c3000 fd:02 16802195                   /usr/lib64/libc-2.17.so
7f5494293000-7f5494297000 r--p 001c3000 fd:02 16802195                   /usr/lib64/libc-2.17.so
7f5494297000-7f5494299000 rw-p 001c7000 fd:02 16802195                   /usr/lib64/libc-2.17.so
7f5494299000-7f549429e000 rw-p 00000000 00:00 0
7f549429e000-7f54942b5000 r-xp 00000000 fd:02 16802221                   /usr/lib64/libpthread-2.17.so
7f54942b5000-7f54944b4000 ---p 00017000 fd:02 16802221                   /usr/lib64/libpthread-2.17.so
7f54944b4000-7f54944b5000 r--p 00016000 fd:02 16802221                   /usr/lib64/libpthread-2.17.so
7f54944b5000-7f54944b6000 rw-p 00017000 fd:02 16802221                   /usr/lib64/libpthread-2.17.so
7f54944b6000-7f54944ba000 rw-p 00000000 00:00 0
7f54944ba000-7f54944bc000 r-xp 00000000 fd:02 16802201                   /usr/lib64/libdl-2.17.so
7f54944bc000-7f54946bc000 ---p 00002000 fd:02 16802201                   /usr/lib64/libdl-2.17.so
7f54946bc000-7f54946bd000 r--p 00002000 fd:02 16802201                   /usr/lib64/libdl-2.17.so
7f54946bd000-7f54946be000 rw-p 00003000 fd:02 16802201                   /usr/lib64/libdl-2.17.so
7f54946be000-7f54947bf000 r-xp 00000000 fd:02 16802203                   /usr/lib64/libm-2.17.so
7f54947bf000-7f54949be000 ---p 00101000 fd:02 16802203                   /usr/lib64/libm-2.17.so
7f54949be000-7f54949bf000 r--p 00100000 fd:02 16802203                   /usr/lib64/libm-2.17.so
7f54949bf000-7f54949c0000 rw-p 00101000 fd:02 16802203                   /usr/lib64/libm-2.17.so
7f54949c0000-7f54949e2000 r-xp 00000000 fd:02 16802188                   /usr/lib64/ld-2.17.so
7f5494a78000-7f5494bc0000 rw-p 00000000 00:00 0
7f5494bdf000-7f5494be1000 rw-p 00000000 00:00 0
7f5494be1000-7f5494be2000 r--p 00021000 fd:02 16802188                   /usr/lib64/ld-2.17.so
7f5494be2000-7f5494be3000 rw-p 00022000 fd:02 16802188                   /usr/lib64/ld-2.17.so
7f5494be3000-7f5494be4000 rw-p 00000000 00:00 0
7ffddd94a000-7ffddd96c000 rw-p 00000000 00:00 0                          [stack]
7ffddd9c6000-7ffddd9c8000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

The following version information may also be useful.

$ opam list
# Packages matching: installed
# Name                 # Installed  # Synopsis
base-bigarray          base
base-bytes             base         Bytes library distributed with the OCaml compiler
base-threads           base
base-unix              base
cairo2                 0.6.1        Binding to Cairo, a 2D Vector Graphics Library
camlp5                 8.00~alpha01 Preprocessor-pretty-printer of OCaml
camomile               1.0.2        A Unicode library
charInfo_width         1.1.0        Determine column width for a character
conf-cairo             1            Virtual package relying on a Cairo system installa
conf-findutils         1            Virtual package relying on findutils
conf-gnome-icon-theme3 0            Virtual package relying on gnome-icon-theme
conf-gtk3              18           Virtual package relying on GTK+ 3
conf-gtksourceview     2            Virtual package relying on a GtkSourceView system 
conf-gtksourceview3    0+2          Virtual package relying on a GtkSourceView-3 syste
conf-m4                1            Virtual package relying on m4
conf-perl              1            Virtual package relying on perl
conf-pkg-config        1.3          Virtual package relying on pkg-config installation
coq                    8.12.0       Formal proof management system
coq-equations          1.2.3+8.12   A function definition package for Coq
coq-ext-lib            0.11.2       A library of Coq definitions, theorems, and tactic
coq-mathcomp-ssreflect 1.11.0       Small Scale Reflection
coq-simple-io          1.3.0        IO monad for Coq
coq-stdpp              1.4.0        std++ is an extended "Standard Library" for Coq
coqide                 8.12.0       IDE of the Coq formal proof management system
cppo                   1.6.6        Code preprocessor like cpp for OCaml
dune                   2.6.2        Fast, portable, and opinionated build system
dune-configurator      2.6.2        Helper library for gathering system configuration
dune-private-libs      2.6.2        Private libraries of Dune
lablgtk                2.18.11      OCaml interface to GTK+
lablgtk3               3.1.1        OCaml interface to GTK+3
lablgtk3-sourceview3   3.1.1        OCaml interface to GTK+ gtksourceview library
lambda-term            3.1.0        Terminal manipulation library for OCaml
logs                   0.7.0        Logging infrastructure for OCaml
lwt                    5.3.0        Promises and event-driven I/O
lwt_log                1.1.1        Lwt logging library (deprecated)
lwt_react              1.1.3        Helpers for using React with Lwt
mew                    0.1.0        Modal editing witch
mew_vi                 0.5.0        Modal editing witch, VI interpreter
mmap                   1.1.0        File mapping functionality
num                    1.3          The legacy Num library for arbitrary-precision int
ocaml                  4.07.1       The OCaml compiler (virtual package)
ocaml-base-compiler    4.07.1       Official release 4.07.1
ocaml-config           1            OCaml Switch Configuration
ocaml-syntax-shims     1.0.0        Backport new syntax to older OCaml versions
ocamlbuild             0.14.0       OCamlbuild is a build system with builtin rules to
ocamlfind              1.8.1        A library manager for OCaml
ocplib-endian          1.1          Optimised functions to read and write int16/32/64 
react                  1.2.1        Declarative events and signals for OCaml
result                 1.5          Compatibility Result module
seq                    base         Compatibility package for OCaml's standard iterato
thrift                 0.10.0       OCaml bindings for the Apache Thrift RPC system
topkg                  1.0.2        The transitory OCaml software packager
trie                   1.0.0        Strict impure trie tree
utop                   2.6.0        Universal toplevel for OCaml
zed                    3.1.0        Abstract engine for text edition in OCaml
Tuplanolla commented 4 years ago

Moved over to ocaml/ocaml#9848, since utop turned out to be unnecessary.