? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app 0.143s ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/html/pages [no test files] ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ? github.com/google/syzkaller/pkg/report/crash [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/signal [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ok github.com/google/syzkaller/executor 5.464s ok github.com/google/syzkaller/pkg/asset (cached) ok github.com/google/syzkaller/pkg/ast 0.756s ok github.com/google/syzkaller/pkg/auth (cached) ok github.com/google/syzkaller/pkg/bisect 46.660s ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build 21.864s ok github.com/google/syzkaller/pkg/compiler 3.617s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover 71.111s ok github.com/google/syzkaller/pkg/cover/backend 0.643s --- FAIL: TestGenerate (54.72s) --- FAIL: TestGenerate/fuchsia/amd64 (0.06s) testutil.go:33: seed=1693873495198380126 testutil.go:33: seed=1693873495262733782 --- FAIL: TestGenerate/fuchsia/amd64/9 (0.44s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:9223372036854775807 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :386:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2699150126 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/7 (0.43s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); loop(); return 0; } :380:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2534052101 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/5 (0.44s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :388:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1341354782 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/2 (0.44s) csource_test.go:150: opts: {Threaded:true Repeat:false RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void loop(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :380:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1915531034 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/12 (0.44s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :388:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2071491645 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/14 (0.44s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:2 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :390:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3259336626 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/1 (0.44s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :386:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3041203332 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/13 (0.38s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:true LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); fprintf(stderr, "### call=0 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); fprintf(stderr, "### call=1 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); fprintf(stderr, "### call=2 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); fprintf(stderr, "### call=3 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 4: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); fprintf(stderr, "### call=4 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); fprintf(stderr, "### call=5 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); fprintf(stderr, "### call=6 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); fprintf(stderr, "### call=7 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 8: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); fprintf(stderr, "### call=8 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); fprintf(stderr, "### call=9 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); res = -1; errno = EFAULT; res = syz_execute_func(/*text=*/0x20000000); fprintf(stderr, "### call=10 errno=%u\n", res == -1 ? errno : 0); break; case 11: res = -1; errno = EFAULT; res = syz_future_time(/*when=*/1); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; case 12: res = -1; errno = EFAULT; res = syz_job_default(); fprintf(stderr, "### call=12 errno=%u\n", res == -1 ? errno : 0); break; case 13: res = -1; errno = EFAULT; res = syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); fprintf(stderr, "### call=13 errno=%u\n", res == -1 ? errno : 0); break; case 14: res = -1; errno = EFAULT; res = syz_process_self(); fprintf(stderr, "### call=14 errno=%u\n", res == -1 ? errno : 0); break; case 15: res = -1; errno = EFAULT; res = syz_thread_self(); fprintf(stderr, "### call=15 errno=%u\n", res == -1 ? errno : 0); break; case 16: res = -1; errno = EFAULT; res = syz_vmar_root_self(); fprintf(stderr, "### call=16 errno=%u\n", res == -1 ? errno : 0); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :412:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor322475408 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/8 (0.44s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:-9223372036854775808 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :386:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2522279471 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/3 (0.45s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/0 (0.45s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/4 (0.45s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/6 (0.45s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:10 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_vmar_unmap(0x0, 0x0, 0x7) (fail_nth: 1) zx_process_create(0x0, &(0x7f0000000000)='+\x00', 0x2, 0x0, &(0x7f0000000040)=0x0, &(0x7f0000000080)=0x0) (async) zx_vmar_allocate(r1, 0x1c000000, 0x401, 0x800, &(0x7f00000000c0), &(0x7f0000000100)) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, 0x0, &(0x7f0000010240)={&(0x7f0000000140)={{}, 0x3ff, {0xf8, 0xffffffffffffffff}, {0x2}, {'+\x00'}, [0x0, 0x1f]}, &(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000010200), 0x44, 0x0, 0x10000}, &(0x7f0000010280), &(0x7f00000102c0)) zx_object_get_info$ZX_INFO_TIMER(0x0, 0x19, &(0x7f0000010300)={0x0, 0x0}, 0x18, &(0x7f0000010340), &(0x7f0000010380)) zx_channel_call$fuchsia_io_DirectoryUnlink(0x0, 0x0, r2, &(0x7f0000020480)={&(0x7f00000103c0)={{}, {0x10000}}, &(0x7f0000010400), &(0x7f0000010440), &(0x7f0000020440), 0x20, 0x0, 0x10000}, &(0x7f00000204c0), &(0x7f0000020500)) zx_channel_call$fuchsia_io_DirectoryAdminGetToken(0x0, 0x0, r2, &(0x7f0000030600)={&(0x7f0000020540), &(0x7f0000020580), &(0x7f00000205c0), &(0x7f00000305c0)={0x0}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000030640), &(0x7f0000030680)) zx_channel_call$fuchsia_cobalt_ControllerGetFailedSendAttempts(r3, 0x0, r2, &(0x7f0000040780)={&(0x7f00000306c0), &(0x7f0000030700), &(0x7f0000030740), &(0x7f0000040740), 0x10, 0x0, 0x10000}, &(0x7f00000407c0), &(0x7f0000040800)) zx_interrupt_wait(r3, &(0x7f0000040840)=0x0) zx_channel_call_etc(r3, 0x7f, r4, &(0x7f0000040b40)={&(0x7f0000040880)="074a597b31ee3390c4e75bc014015d5fe0c28ddd71f6488c956ae017f6de56f964912cc7a4c3631e12dc1a772ac50578223b8481cfc6cb4168b4f8b90a029a185d228e79af8f119ddf5454136dc3394dec8980889f756caecd3451150bbaa897858556dd9f46914783ccfff5dc9884634c078543b5a0b62c1c43502276b665894ac2ad841cc13837b671eb09fb264e74cd603d440f20f206b731ab43cdbb2c31e0eae34dfb5c1c0e7af894716c51b06274f512af406cab884dd0", &(0x7f0000040a40)=[0x0, r0, 0x0, r3], &(0x7f0000040a80)=""/71, &(0x7f0000040b00)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xba, 0x4, 0x47, 0xa}, &(0x7f0000040b80), &(0x7f0000040bc0)) syz_execute_func(&(0x7f0000000000)="c401fc5ab50e0000008f0978e2e0c4c3fd0d4701f70f0fb20c000000b0c4c17e6fc3c4c1fc50e5c4c15564c6c46245985f2ac44271a832c4417d5ad2") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffe000/0x1000)=nil, 0x1000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 500); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_vmar_unmap))(/*handle=*/0, /*addr=*/0, /*len=*/7); break; case 1: memcpy((void*)0x20000000, "+\000", 2); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_process_create))(/*job=*/0, /*name=*/0x20000000, /*name_len=*/2, /*options=*/0, /*proc_handle=*/0x20000040, /*vmar_handle=*/0x20000080); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000040; r[1] = *(uint32_t*)0x20000080; } break; case 2: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(/*parent_vmar=*/r[1], /*options=*/0x1c000000, /*offset=*/0x401, /*size=*/0x800, /*child_vmar=*/0x200000c0, /*child_addr=*/0x20000100); } } break; case 3: *(uint64_t*)0x20010240 = 0x20000140; *(uint32_t*)0x20000140 = 0; memset((void*)0x20000144, 0, 3); *(uint8_t*)0x20000147 = 1; *(uint64_t*)0x20000148 = 0x591cb25600000000; *(uint32_t*)0x20000150 = 0x3ff; *(uint64_t*)0x20000154 = 0xf8; *(uint64_t*)0x2000015c = -1; *(uint64_t*)0x20000164 = 2; *(uint64_t*)0x2000016c = 0; memcpy((void*)0x20000174, "+\000", 2); *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = 0x1f; *(uint64_t*)0x20010248 = 0x200001c0; *(uint64_t*)0x20010250 = 0x20000200; *(uint64_t*)0x20010258 = 0x20010200; *(uint32_t*)0x20010260 = 0x44; *(uint32_t*)0x20010264 = 0; *(uint32_t*)0x20010268 = 0x10000; *(uint32_t*)0x2001026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20010240, /*actual_bytes=*/0x20010280, /*actual_handles=*/0x200102c0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x19, /*buffer=*/0x20010300, /*buffer_size=*/0x18, /*actual=*/0x20010340, /*avail=*/0x20010380); if (res == ZX_OK) r[2] = *(uint64_t*)0x20010308; break; case 5: *(uint64_t*)0x20020480 = 0x200103c0; *(uint32_t*)0x200103c0 = 0; memset((void*)0x200103c4, 0, 3); *(uint8_t*)0x200103c7 = 1; *(uint64_t*)0x200103c8 = 0x2cbadb1900000000; *(uint64_t*)0x200103d0 = 0x10000; *(uint64_t*)0x200103d8 = 0; *(uint64_t*)0x20020488 = 0x20010400; *(uint64_t*)0x20020490 = 0x20010440; *(uint64_t*)0x20020498 = 0x20020440; *(uint32_t*)0x200204a0 = 0x20; *(uint32_t*)0x200204a4 = 0; *(uint32_t*)0x200204a8 = 0x10000; *(uint32_t*)0x200204ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20020480, /*actual_bytes=*/0x200204c0, /*actual_handles=*/0x20020500); break; case 6: *(uint64_t*)0x20030600 = 0x20020540; *(uint32_t*)0x20020540 = 0; memset((void*)0x20020544, 0, 3); *(uint8_t*)0x20020547 = 1; *(uint64_t*)0x20020548 = 0x3217bced00000000; *(uint64_t*)0x20030608 = 0x20020580; *(uint64_t*)0x20030610 = 0x200205c0; *(uint64_t*)0x20030618 = 0x200305c0; *(uint32_t*)0x20030620 = 0x10; *(uint32_t*)0x20030624 = 0; *(uint32_t*)0x20030628 = 0x10000; *(uint32_t*)0x2003062c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[2], /*args=*/0x20030600, /*actual_bytes=*/0x20030640, /*actual_handles=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x200305c0; break; case 7: *(uint64_t*)0x20040780 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; memset((void*)0x200306c4, 0, 3); *(uint8_t*)0x200306c7 = 1; *(uint64_t*)0x200306c8 = 0x3a378f4700000000; *(uint64_t*)0x20040788 = 0x20030700; *(uint64_t*)0x20040790 = 0x20030740; *(uint64_t*)0x20040798 = 0x20040740; *(uint32_t*)0x200407a0 = 0x10; *(uint32_t*)0x200407a4 = 0; *(uint32_t*)0x200407a8 = 0x10000; *(uint32_t*)0x200407ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20040780, /*actual_bytes=*/0x200407c0, /*actual_handles=*/0x20040800); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(/*handle=*/r[3], /*out_timestamp=*/0x20040840); if (res == ZX_OK) r[4] = *(uint64_t*)0x20040840; break; case 9: *(uint64_t*)0x20040b40 = 0x20040880; memcpy((void*)0x20040880, "\x07\x4a\x59\x7b\x31\xee\x33\x90\xc4\xe7\x5b\xc0\x14\x01\x5d\x5f\xe0\xc2\x8d\xdd\x71\xf6\x48\x8c\x95\x6a\xe0\x17\xf6\xde\x56\xf9\x64\x91\x2c\xc7\xa4\xc3\x63\x1e\x12\xdc\x1a\x77\x2a\xc5\x05\x78\x22\x3b\x84\x81\xcf\xc6\xcb\x41\x68\xb4\xf8\xb9\x0a\x02\x9a\x18\x5d\x22\x8e\x79\xaf\x8f\x11\x9d\xdf\x54\x54\x13\x6d\xc3\x39\x4d\xec\x89\x80\x88\x9f\x75\x6c\xae\xcd\x34\x51\x15\x0b\xba\xa8\x97\x85\x85\x56\xdd\x9f\x46\x91\x47\x83\xcc\xff\xf5\xdc\x98\x84\x63\x4c\x07\x85\x43\xb5\xa0\xb6\x2c\x1c\x43\x50\x22\x76\xb6\x65\x89\x4a\xc2\xad\x84\x1c\xc1\x38\x37\xb6\x71\xeb\x09\xfb\x26\x4e\x74\xcd\x60\x3d\x44\x0f\x20\xf2\x06\xb7\x31\xab\x43\xcd\xbb\x2c\x31\xe0\xea\xe3\x4d\xfb\x5c\x1c\x0e\x7a\xf8\x94\x71\x6c\x51\xb0\x62\x74\xf5\x12\xaf\x40\x6c\xab\x88\x4d\xd0", 186); *(uint64_t*)0x20040b48 = 0x20040a40; *(uint32_t*)0x20040a40 = 0; *(uint32_t*)0x20040a44 = r[0]; *(uint32_t*)0x20040a48 = 0; *(uint32_t*)0x20040a4c = r[3]; *(uint64_t*)0x20040b50 = 0x20040a80; *(uint64_t*)0x20040b58 = 0x20040b00; *(uint32_t*)0x20040b60 = 0xba; *(uint32_t*)0x20040b64 = 4; *(uint32_t*)0x20040b68 = 0x47; *(uint32_t*)0x20040b6c = 0xa; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); break; case 10: memcpy((void*)0x20000000, "\xc4\x01\xfc\x5a\xb5\x0e\x00\x00\x00\x8f\x09\x78\xe2\xe0\xc4\xc3\xfd\x0d\x47\x01\xf7\x0f\x0f\xb2\x0c\x00\x00\x00\xb0\xc4\xc1\x7e\x6f\xc3\xc4\xc1\xfc\x50\xe5\xc4\xc1\x55\x64\xc6\xc4\x62\x45\x98\x5f\x2a\xc4\x42\x71\xa8\x32\xc4\x41\x7d\x5a\xd2", 60); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffe000, /*len=*/0x1000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :386:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[3], /*options=*/0x7f, /*deadline=*/r[4], /*args=*/0x20040b40, /*actual_bytes=*/0x20040b80, /*actual_handles=*/0x20040bc0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3454624736 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/10 (2.28s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 65.460s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ok github.com/google/syzkaller/pkg/email/lore (cached) ok github.com/google/syzkaller/pkg/host 46.431s ok github.com/google/syzkaller/pkg/html (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image 2.205s ok github.com/google/syzkaller/pkg/instance 4.562s ok github.com/google/syzkaller/pkg/ipc 72.639s ok github.com/google/syzkaller/pkg/kconfig (cached) ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 3.868s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 40.391s ok github.com/google/syzkaller/pkg/repro 3.784s ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin [no test files] ? github.com/google/syzkaller/sys/darwin/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ? github.com/google/syzkaller/syz-runner [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-build [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fillreports [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-imagegen [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ? github.com/google/syzkaller/tools/syz-lore [no test files] ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-minconfig [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-query-subsystems [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbed [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/cuttlefish [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/proxyapp/mocks [no test files] ? github.com/google/syzkaller/vm/proxyapp/proxyrpc [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ? github.com/google/syzkaller/vm/starnix [no test files] ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] ok github.com/google/syzkaller/pkg/runtest 92.703s ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem (cached) ok github.com/google/syzkaller/pkg/subsystem/linux (cached) ok github.com/google/syzkaller/pkg/subsystem/lists (cached) ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ok github.com/google/syzkaller/prog 15.819s ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux 0.139s ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci 2.173s ok github.com/google/syzkaller/syz-fuzzer 0.448s ok github.com/google/syzkaller/syz-hub 0.030s ok github.com/google/syzkaller/syz-hub/state 0.048s ok github.com/google/syzkaller/syz-manager 2.408s ok github.com/google/syzkaller/syz-verifier 2.102s ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/parser 0.300s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 0.991s ok github.com/google/syzkaller/vm 10.059s ok github.com/google/syzkaller/vm/isolated 1.972s ok github.com/google/syzkaller/vm/proxyapp 4.179s ok github.com/google/syzkaller/vm/vmimpl 2.039s FAIL