Skip to content

segmentation fault when running clang built wasm #7

@xyproto

Description

@xyproto

When running wac on sha1sum.wasm from the vmir project, I get the following error:

./wac ~/clones/vmir/examples/prebuilt/sha1sum.wasm
zsh: segmentation fault (core dumped)  ./wac ~/clones/vmir/examples/prebuilt/sha1sum.wasm

I'm using:

  • latest master of wac, commit 1197a2d
  • 64-bit Arch Linux with the official gcc package (gcc 8.1.1)
  • lib32-libedit from AUR

When compiling with -O1 -g and using bt full in gdb, this is the output:

(gdb) r ~/clones/vmir/examples/prebuilt/sha1sum.wasm
Starting program: /home/afr/clones/wac/wac ~/clones/vmir/examples/prebuilt/sha1sum.wasm

Program received signal SIGSEGV, Segmentation fault.
0xf7dae279 in __memset_sse2 () from /usr/lib32/libc.so.6
(gdb) bt full
#0  0xf7dae279 in __memset_sse2 () from /usr/lib32/libc.so.6
No symbol table info available.
#1  0x565655b0 in thunk_out_i_iii (m=0xf7b2d010, function=0x5658b2b8, type=0x5658a6dc) at thunks.c:454
        res = <optimized out>
#2  0x5655fc11 in thunk_out (m=0xf7b2d010, fidx=2) at wa.c:544
        func = 0x5658b2b8
        type = 0x5658a6dc
        thunk_mask = 8454417
        p = <optimized out>
#3  0x565601e3 in interpret (m=0xf7b2d010) at wa.c:809
        block = <optimized out>
        prev_pages = <optimized out>
        sval = <optimized out>
        didx = <optimized out>
        delta = <optimized out>
        bytes = 0xf7fd0000 ""
        stack = 0xf7b2d074
        cur_pc = 492
        block = <optimized out>
        arg = <optimized out>
        val = <optimized out>
        fidx = <optimized out>
        tidx = <optimized out>
        cond = <optimized out>
        depth = <optimized out>
        count = <optimized out>
        flags = <optimized out>
        offset = <optimized out>
        addr = <optimized out>
        maddr = <optimized out>
        mem_end = <optimized out>
        depths = <optimized out>
        opcode = 16 '\020'
        a = <optimized out>
        b = <optimized out>
        c = 4294967104
        d = <optimized out>
        e = <optimized out>
        f = 6221221224307818496
        g = <optimized out>
        h = <optimized out>
        i = -1.03310949e+34
        j = <optimized out>
        k = <optimized out>
        l = 1.3447704791445071e-313
        overflow = false
#4  0x56563be8 in invoke (m=0xf7b2d010, entry=<optimized out>, argc=-1, argv=0xffffd0c0) at wa.c:1997
        fidx = 6
        type = 0x5658a6a0
        result = <optimized out>
#5  0x5655eec7 in main (argc=<optimized out>, argv=<optimized out>) at wac.c:63
        mod_path = <optimized out>
        entry = <optimized out>
        line = <optimized out>
        repl = 0
        debug = 0
        res = 0
        option_index = 0
        c = <optimized out>
        long_options = {{name = 0x5657545c "repl", has_arg = 0, flag = 0xffffcfac, val = 1}, {name = 0x56575461 "debug", has_arg = 0, flag = 0xffffcfb0, val = 1}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
        opts = {disable_memory_bounds = false, mangle_table_index = false, dlsym_trim_underscore = false}
        m = <optimized out>
(gdb)

The problematic line could be line 454 in thunks.c?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions