Vagabond / erlang-syslog

Erlang port driver for interacting with syslog via syslog(3)
Other
87 stars 55 forks source link

Can repeatably crash Erlang #3

Closed efine closed 11 years ago

efine commented 12 years ago

Summary

The code below will crash the emulator in R15B01 i386 and x86_64. I've repeated this on Debian 6.0.5 (64-bit), CentOS 6.3 (32-bit), and Ubuntu 12.04 (64-bit). I haven't tried other distros or versions of Erlang.

-module(crash_syslog).
-compile([export_all]).

boom() ->
    {ok, _Pid} = syslog:start(),
    syslog:open("Beuha", [cons, perror, pid], local0),
    syslog:log(err, "Damned"),
    syslog:open(foo, [cons, perror, pid], local0),
    io:format("Erlang is now going to crash~n", []),
    syslog:open("Beuha", [cons, perror, pid], local0),
    io:format("Ok, I lied.~n", []),
    ok.

Installing and running

$ git clone git://github.com/Vagabond/erlang-syslog.git
Initialized empty Git repository in /tmp/erlang-syslog/.git/
remote: Counting objects: 94, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 94 (delta 45), reused 71 (delta 31)
Receiving objects: 100% (94/94), 92.75 KiB, done.
Resolving deltas: 100% (45/45), done.
$ cd erlang-syslog/
$ ./rebar compile
==> erlang-syslog (compile)
Compiled src/syslog_app.erl
Compiled src/syslog_sup.erl
Compiled src/syslog.erl
Compiling c_src/syslog_drv.c
$ sudo ./rebar install
==> erlang-syslog (install)
Installing: syslog-0.0.1 to /usr/lib/erlang/lib
$ erlc crash_syslog.erl 
$ erl -s crash_syslog boom
Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

Erlang is now going to crash
*** glibc detected *** /usr/lib/erlang/erts-5.9.1/bin/beam.smp: double free or corruption (fasttop): 0xb3704480 ***

Environment

I've listed hopefully all info needed.

CentOS

$ lsb_release -a
LSB Version:    :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.3 (Final)
Release:    6.3
Codename:   Final

$ gcc --version
gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)

$ erl
Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

Debian

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 6.0.5 (squeeze)
Release:    6.0.5
Codename:   squeeze

$ gcc --version
gcc (Debian 4.4.5-8) 4.4.5

$ erl
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]

Ubuntu

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.1 LTS
Release:    12.04
Codename:   precise
$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
$ erl
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]