[OpenBSD] staticperl dying unexpectedly with Coro/jit...

nomad at null.net nomad at null.net
Thu Oct 27 15:59:41 CEST 2016


On Fri Oct 21, 2016 at 10:24:12AM +0200, Marc Lehmann wrote:
> 
> > [I'm not entirely sure I've got that reasoning right though]
> 
> These EX_ codes really are the exit codes, so EX_NOPERM would be exit code
> 77. 141 probably means "killed by signal 141 - 128 = 13" ... I assume
> signal 13 is ABRT because of this:
> 
> >     staticperl perl -MCoro -E 'warn Coro->VERSION'
> >     Abort trap (core dumped) # but it is version 6.511
> 
> What's the significance of your comment "but it is version 6.511", simply
> that it is the latest?

Yes.

> > Any ideas on how I can debug this further?
> 
> Yes, make sure everything is compiled with debug info (it might
> already be), then create a coredump and make a backtrace.
> Alternatively, run it under a debugger (e.g. gdb) and see till it
> crashes and make a backtrace, or even set a breakpoint in the abort
> function and see if it is reached. I assume you already know how to
> do this, if not, I will happily explain in more detail :)

I took this opportunity to learn about debugging (part of the reason
for taking this long to get back) and this is what I see:

    This GDB was configured as "amd64-unknown-openbsd6.0"...
    (gdb) run -E 'use Coro::State'
    Starting program: /mark/src/bif/static/staticperl/perl/bin/perl -E 'use Coro::State'

    Program received signal SIGABRT, Aborted.
    0x00001d7e836f53ca in _thread_sys___syscall () at <stdin>:2
        in <stdin>
    Current language:  auto; currently asm

    (gdb) backtrace
    #0  0x00001d7e836f53ca in _thread_sys___syscall () at <stdin>:2
    #1  0x00001d7e8374110a in *_libc_mmap (addr=)
        at /usr/src/lib/libc/sys/mmap.c:47
    #2  0x00001d7c0c86f0b5 in jit_init () at State.xs:3588
    #3  0x00001d7c0c8751e8 in boot_Coro__State (cv=) at State.xs:3703
    #4  0x00001d7c0c91f48d in Perl_pp_goto () at pp_ctl.c:2916
    #5  0x00001d7c0c8eba91 in Perl_runops_standard () at run.c:42
    #6  0x00001d7c0c88dfc8 in Perl_call_sv (sv=0x1d7e47b054e0, flags=13)
        at perl.c:2775
    #7  0x00001d7c0c88e3f1 in Perl_call_list (oldscope=9, paramList=0x1d7e4e0c0750)
        at perl.c:4872
    #8  0x00001d7c0c87aea4 in S_process_special_blocks (floor=) at op.c:8125
    #9  0x00001d7c0c887b4d in Perl_newATTRSUB_x (floor=177, o=0x1d7e8b9030a8, 
        proto=0x0, attrs=0x0, block=0x1d7ebb52f230, o_is_gv=255) at op.c:8087
    #10 0x00001d7c0c8b3871 in Perl_yyparse (gramtype=) at perly.y:350
    #11 0x00001d7c0c915b05 in S_doeval (gimme=) at pp_ctl.c:3487
    #12 0x00001d7c0c917b29 in Perl_pp_require () at pp_ctl.c:4146
    #13 0x00001d7c0c8eba91 in Perl_runops_standard () at run.c:42
    #14 0x00001d7c0c88dfc8 in Perl_call_sv (sv=0x1d7e2e8eadf8, flags=13)
        at perl.c:2775
    #15 0x00001d7c0c88e3f1 in Perl_call_list (oldscope=2, paramList=0x1d7e2e8eae58)
        at perl.c:4872
    #16 0x00001d7c0c87aea4 in S_process_special_blocks (floor=) at op.c:8125
    #17 0x00001d7c0c887b4d in Perl_newATTRSUB_x (floor=37, o=0x1d7e4dc50398, 
        proto=0x0, attrs=0x0, block=0x1d7eb4106ac0, o_is_gv=255) at op.c:8087
    #18 0x00001d7c0c886672 in Perl_utilize (aver=1, floor=37, version=)
        at op.c:5445
    #19 0x00001d7c0c8b38f7 in Perl_yyparse (gramtype=) at perly.y:398
    #20 0x00001d7c0c8901c7 in S_parse_body (env=0x0, 
        xsinit=0x1d7c0c72fd0d <xs_init>) at perl.c:2302
    #21 0x00001d7c0c8906da in perl_parse (my_perl=) at perl.c:1607
    #22 0x00001d7c0c72fc98 in main (argc=3, argv=0x7f7ffffc4c28, 
        env=0x7f7ffffc4c48) at ./perlmain.c:112
    (gdb) q
    The program is running.  Exit anyway? (y or n) 

So it looks like it maybe something to do with the JIT compiler. But
not necessarily a Coro assert trigging the abort.

If I disable the JIT feature (also had to learn about the fact that
Coro has a bunch of features) I no longer see the abort under
staticperl.

If I build Coro using the system perl *with* the JIT option enabled the
tests all pass, and I can't reproduce the abort. So that brings me back
to some kind of Coro(JIT)/Staticperl interaction.

Relevant perhaps still is your suggestion about looking at the system
package for Coro. A comment on a recent openbsd mailing list
discussion[1] claims that the coro JIT "violates W^X" and they are
disabling JIT because of that.

[1] http://openbsd-archive.7691.n7.nabble.com/UPDATE-devel-p5-Coro-to-6-511-patch-td306649.html

I have no idea what W^X refers to. I also don't know what behaviour (if
any) they are referring to because it seems to work for me under normal
conditions.

Regards,
Mark
-- 
Mark Lawrence



More information about the anyevent mailing list