Skip to content

Running multiple fuzz tests segfaults #26040

@ozgrakkurt

Description

@ozgrakkurt

Zig Version

0.16.0-dev.1456+16fc083f2

Steps to Reproduce and Observed Behavior

Zig downloaded from the downloads page: zig-x86_64-linux-0.16.0-dev.1456+16fc083f2.tar.xz

Running multiple fuzz tests at the same time cases a segfault error:

zig build fuzz --fuzz -Doptimize=ReleaseSafe -j64
info(web_server): web interface listening at http://[::1]:43323/
info(web_server): hint: pass '--webui=[::1]:43323' to use the same port next time
Build Summary: 7/7 steps succeeded; 2/2 tests passed
Segmentation fault at address 0x7f6a022520e8
/home/ozgur/zig/out/lib/std/heap/debug_allocator.zig:907:23: 0x12607d4 in free (std.zig)
            if (bucket.canary != config.canary) @panic("Invalid free");
                      ^
/home/ozgur/zig/out/lib/std/mem/Allocator.zig:160:25: 0x1122789 in rawFree (std.zig)
    return a.vtable.free(a.ptr, memory, alignment, ret_addr);
                        ^
/home/ozgur/zig/out/lib/std/Build/Step/Run.zig:1145:22: 0x131728c in rerunInFuzzMode (std.zig)
        fuzz.gpa.free(cmd);
                     ^
/home/ozgur/zig/out/lib/std/Build/Fuzz.zig:206:24: 0x1317ff1 in fuzzWorkerRun (std.zig)
    run.rerunInFuzzMode(fuzz, unit_test_index, prog_node) catch |err| switch (err) {
                       ^
/home/ozgur/zig/out/lib/std/Thread/Pool.zig:118:39: 0x1318412 in runFn (std.zig)
            @call(.auto, func, closure.arguments);
                                      ^
/home/ozgur/zig/out/lib/std/Thread/Pool.zig:293:27: 0x1365c40 in worker (std.zig)
            runnable.runFn(runnable, id);
                          ^
/home/ozgur/zig/out/lib/std/Thread.zig:559:13: 0x12d3bd0 in callFn__anon_82208 (std.zig)
            @call(.auto, f, args);
            ^
/home/ozgur/zig/out/lib/std/Thread.zig:1535:30: 0x1299ec0 in entryFn (std.zig)
                return callFn(f, self.fn_args);
                             ^
/home/ozgur/zig/out/lib/std/os/linux/x86_64.zig:105:5: 0x11782b5 in clone (std.zig)
    asm volatile (
    ^
error: the following build command crashed:
.zig-cache/o/f7cec3636184dd88ed02791b925daf2f/build /home/ozgur/zig/out/zig /home/ozgur/zig/out/lib /home/ozgur/repos/olive .zig-cache /home/ozgur/.cache/zig --seed 0x4858de98 -Z77191c04cb9254a0 fuzz --fuzz -Doptimize=ReleaseSafe -j64

Seems like the new fuzz test running logic is broken. Reverting to 0.16.0-dev.312+164c598cd fixes the issue for me.

Not sure if this issue happens when there is a single fuzz test entrypoint.

Expected Behavior

Fuzzing shouldn't cause crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions