? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app 0.066s ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [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/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [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] ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/darwin/gen [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/akaros [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/darwin [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/executor 1.992s ok github.com/google/syzkaller/pkg/asset 0.058s ok github.com/google/syzkaller/pkg/ast 0.662s ok github.com/google/syzkaller/pkg/auth 0.009s ok github.com/google/syzkaller/pkg/bisect 23.150s ok github.com/google/syzkaller/pkg/bisect/minimize 0.052s ok github.com/google/syzkaller/pkg/build 4.306s ok github.com/google/syzkaller/pkg/compiler 3.192s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover 12.943s ok github.com/google/syzkaller/pkg/cover/backend 0.573s --- FAIL: TestGenerate (15.86s) --- FAIL: TestGenerate/fuchsia/amd64 (0.14s) testutil.go:33: seed=1689085399478277143 testutil.go:33: seed=1689085399618048001 --- FAIL: TestGenerate/fuchsia/amd64/3 (0.39s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:10 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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; } :355: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1322241909 -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 (0.39s) 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:false HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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(); do_sandbox_none(); return 0; } :343: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1903237449 -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.40s) 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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; } :357: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3054674517 -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.39s) 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 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_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); fprintf(stderr, "### call=0 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 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[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); fprintf(stderr, "### call=1 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 2: res = -1; errno = EFAULT; res = syz_future_time(/*when=*/1); fprintf(stderr, "### call=2 errno=%u\n", res == -1 ? errno : 0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; 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[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); fprintf(stderr, "### call=3 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); fprintf(stderr, "### call=4 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); fprintf(stderr, "### call=5 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; 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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); fprintf(stderr, "### call=6 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); 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,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); fprintf(stderr, "### call=8 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 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[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); fprintf(stderr, "### call=9 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); 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=*/0); 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=*/0x20ffd000, /*len=*/0x3000); 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; } :371: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2278869923 -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/4 (0.39s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:1 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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; } :355: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor501802693 -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.38s) 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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; } :357: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1571737606 -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.40s) 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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; } :355: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor4050111126 -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/0 (0.40s) csource_test.go:150: opts: {Threaded:false 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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 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() { } 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; } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_one(void) { intptr_t res = 0; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); syz_future_time(/*when=*/0); syz_job_default(); syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); syz_process_self(); syz_thread_self(); syz_vmar_root_self(); } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :210: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3877567728 -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/6 (0.40s) 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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; } :355: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor261535021 -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.40s) 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_eventpair_create$VALID_OPTIONS(0x0, &(0x7f0000000000)=0x0, &(0x7f0000000040)=0x0) (fail_nth: 1) zx_channel_call$fuchsia_io_DirectoryRename(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010140)={&(0x7f0000000080)={{}, {0x5, 0xffffffffffffffff}, 0xffffffff, {0xea5, 0xffffffffffffffff}, {'.'}}, &(0x7f00000000c0), &(0x7f0000000100), &(0x7f0000010100), 0x3c, 0x1, 0x10000}, &(0x7f0000010180), &(0x7f00000101c0)) (async) r2 = syz_future_time(0x1) (rerun: 4) zx_channel_call$fuchsia_process_ResolverResolve(r0, 0x0, r2, &(0x7f00000202c0)={&(0x7f0000010200)={{}, {0x8000000000000000}, {'.'}}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280)={0x0, 0x0}, 0x28, 0x0, 0x10000, 0x2}, &(0x7f0000020300), &(0x7f0000020340)) zx_clock_create(0x0, &(0x7f0000020380), &(0x7f00000203c0)=0x0) zx_channel_read(r3, 0x1, &(0x7f0000020500)=""/4096, &(0x7f0000021500)=0x0, 0x1000, 0x4, &(0x7f0000021540), &(0x7f0000021580)) zx_channel_call_etc(r4, 0x9, r2, &(0x7f0000021700)={&(0x7f0000020400)="ded9e2a4dec342215bffd85e24001dd5e8f5de9d07dbc8d38597593a11bedee272f2b588d4d46f26b104f56177bb2c2fad5188e98a1c97c7339dd21de83e55aae676c2c4a663bbcf807a8154cbd6e05b70b448969faee569473af6863b496c67dc5045755d99f1858d76202ece300b7933f2c9efe4e2834c132bf677885cfe21bc98b246440a6867d7913f05405ce870d513d683dc000018dc517b245011834973a6852cd31bf816398d91382af428c37bff27ae1f0cbbb38b9a1732e533aa0705a787", &(0x7f00000215c0)=[r3, r5, r0], &(0x7f0000021600)=""/175, &(0x7f00000216c0)=[0x0, 0x0], 0xc3, 0x3, 0xaf, 0x2}, &(0x7f0000021740), &(0x7f0000021780)) zx_channel_call$fuchsia_io_NodeDescribe(0x0, 0x0, r2, &(0x7f0000031880)={&(0x7f00000217c0), &(0x7f0000021800), &(0x7f0000021840), &(0x7f0000031840)={@stream_socket}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000318c0), &(0x7f0000031900)) zx_pc_firmware_tables(r5, &(0x7f0000031940), &(0x7f0000031980)) zx_channel_call$fuchsia_cobalt_LoggerStartTimer(r0, 0x0, r2, &(0x7f0000041ac0)={&(0x7f00000319c0)={{}, 0x1f, 0x3f, {0xfffffffffffffffb, 0xffffffffffffffff}, {0x75, 0xffffffffffffffff}, 0x6, 0x5, {'*[!'}, {'\x8c\x89[%\xaa'}}, &(0x7f0000031a40), &(0x7f0000031a80), &(0x7f0000041a80), 0x54, 0x0, 0x10000}, &(0x7f0000041b00), &(0x7f0000041b40)) syz_execute_func(&(0x7f0000000000)="44dbdb660f382065c7c44275ae0ac4e2e5a7e166450f0ff1bf4613bc680a00000026440fc14c1f7c0f1813c463915d3f008f2848ee1b68") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x3000)=nil, 0x3000) 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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x20000000, /*out1=*/0x20000040); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000040; } break; case 1: *(uint64_t*)0x20010140 = 0x20000080; *(uint32_t*)0x20000080 = 0; memset((void*)0x20000084, 0, 3); *(uint8_t*)0x20000087 = 1; *(uint64_t*)0x20000088 = 0x4a94b0ac00000000; *(uint64_t*)0x20000090 = 5; *(uint64_t*)0x20000098 = -1; *(uint32_t*)0x200000a0 = -1; *(uint64_t*)0x200000a4 = 0xea5; *(uint64_t*)0x200000ac = -1; memset((void*)0x200000b4, 46, 1); *(uint64_t*)0x20010148 = 0x200000c0; *(uint32_t*)0x200000c0 = 0; *(uint64_t*)0x20010150 = 0x20000100; *(uint64_t*)0x20010158 = 0x20010100; *(uint32_t*)0x20010160 = 0x3c; *(uint32_t*)0x20010164 = 1; *(uint32_t*)0x20010168 = 0x10000; *(uint32_t*)0x2001016c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010140, /*actual_bytes=*/0x20010180, /*actual_handles=*/0x200101c0); break; case 2: res = -1; res = syz_future_time(/*when=*/1); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/1); } } if ((int)res != -1) r[2] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x20010200; *(uint32_t*)0x20010200 = 0; memset((void*)0x20010204, 0, 3); *(uint8_t*)0x20010207 = 1; *(uint64_t*)0x20010208 = 0x20980a8100000000; *(uint64_t*)0x20010210 = 0x8000000000000000; *(uint64_t*)0x20010218 = 0; memset((void*)0x20010220, 46, 1); *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x28; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 2; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); if (res == ZX_OK) r[3] = *(uint32_t*)0x20020284; break; case 4: *(uint64_t*)0x20020380 = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_create))(/*option=*/0, /*args=*/0x20020380, /*out=*/0x200203c0); if (res == ZX_OK) r[4] = *(uint32_t*)0x200203c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[3], /*options=*/1, /*bytes=*/0x20020500, /*handles=*/0x20021500, /*num_bytes=*/0x1000, /*num_handles=*/4, /*actual_bytes=*/0x20021540, /*actual_handles=*/0x20021580); if (res == ZX_OK) r[5] = *(uint32_t*)0x20021500; break; case 6: *(uint64_t*)0x20021700 = 0x20020400; memcpy((void*)0x20020400, "\xde\xd9\xe2\xa4\xde\xc3\x42\x21\x5b\xff\xd8\x5e\x24\x00\x1d\xd5\xe8\xf5\xde\x9d\x07\xdb\xc8\xd3\x85\x97\x59\x3a\x11\xbe\xde\xe2\x72\xf2\xb5\x88\xd4\xd4\x6f\x26\xb1\x04\xf5\x61\x77\xbb\x2c\x2f\xad\x51\x88\xe9\x8a\x1c\x97\xc7\x33\x9d\xd2\x1d\xe8\x3e\x55\xaa\xe6\x76\xc2\xc4\xa6\x63\xbb\xcf\x80\x7a\x81\x54\xcb\xd6\xe0\x5b\x70\xb4\x48\x96\x9f\xae\xe5\x69\x47\x3a\xf6\x86\x3b\x49\x6c\x67\xdc\x50\x45\x75\x5d\x99\xf1\x85\x8d\x76\x20\x2e\xce\x30\x0b\x79\x33\xf2\xc9\xef\xe4\xe2\x83\x4c\x13\x2b\xf6\x77\x88\x5c\xfe\x21\xbc\x98\xb2\x46\x44\x0a\x68\x67\xd7\x91\x3f\x05\x40\x5c\xe8\x70\xd5\x13\xd6\x83\xdc\x00\x00\x18\xdc\x51\x7b\x24\x50\x11\x83\x49\x73\xa6\x85\x2c\xd3\x1b\xf8\x16\x39\x8d\x91\x38\x2a\xf4\x28\xc3\x7b\xff\x27\xae\x1f\x0c\xbb\xb3\x8b\x9a\x17\x32\xe5\x33\xaa\x07\x05\xa7\x87", 195); *(uint64_t*)0x20021708 = 0x200215c0; *(uint32_t*)0x200215c0 = r[3]; *(uint32_t*)0x200215c4 = r[5]; *(uint32_t*)0x200215c8 = r[0]; *(uint64_t*)0x20021710 = 0x20021600; *(uint64_t*)0x20021718 = 0x200216c0; *(uint32_t*)0x20021720 = 0xc3; *(uint32_t*)0x20021724 = 3; *(uint32_t*)0x20021728 = 0xaf; *(uint32_t*)0x2002172c = 2; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/r[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); break; case 7: *(uint64_t*)0x20031880 = 0x200217c0; *(uint32_t*)0x200217c0 = 0; memset((void*)0x200217c4, 0, 3); *(uint8_t*)0x200217c7 = 1; *(uint64_t*)0x200217c8 = 0x1f62df5e00000000; *(uint64_t*)0x20031888 = 0x20021800; *(uint64_t*)0x20031890 = 0x20021840; *(uint64_t*)0x20031898 = 0x20031840; *(uint32_t*)0x200318a0 = 0x10; *(uint32_t*)0x200318a4 = 0; *(uint32_t*)0x200318a8 = 0x10000; *(uint32_t*)0x200318ac = 1; ((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=*/0x20031880, /*actual_bytes=*/0x200318c0, /*actual_handles=*/0x20031900); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_pc_firmware_tables))(/*handle=*/r[5], /*acpi_rsdp=*/0x20031940, /*smbios=*/0x20031980); break; case 9: *(uint64_t*)0x20041ac0 = 0x200319c0; *(uint32_t*)0x200319c0 = 0; memset((void*)0x200319c4, 0, 3); *(uint8_t*)0x200319c7 = 1; *(uint64_t*)0x200319c8 = 0x4a5c612000000000; *(uint32_t*)0x200319d0 = 0x1f; *(uint32_t*)0x200319d4 = 0x3f; *(uint64_t*)0x200319d8 = 0xfffffffffffffffb; *(uint64_t*)0x200319e0 = -1; *(uint64_t*)0x200319e8 = 0x75; *(uint64_t*)0x200319f0 = -1; *(uint64_t*)0x200319f8 = 6; *(uint32_t*)0x20031a00 = 5; memcpy((void*)0x20031a04, "*[!", 3); memcpy((void*)0x20031a0c, "\214\211[%\252", 5); *(uint64_t*)0x20041ac8 = 0x20031a40; *(uint64_t*)0x20041ad0 = 0x20031a80; *(uint64_t*)0x20041ad8 = 0x20041a80; *(uint32_t*)0x20041ae0 = 0x54; *(uint32_t*)0x20041ae4 = 0; *(uint32_t*)0x20041ae8 = 0x10000; *(uint32_t*)0x20041aec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[0], /*options=*/0, /*deadline=*/r[2], /*args=*/0x20041ac0, /*actual_bytes=*/0x20041b00, /*actual_handles=*/0x20041b40); break; case 10: memcpy((void*)0x20000000, "\x44\xdb\xdb\x66\x0f\x38\x20\x65\xc7\xc4\x42\x75\xae\x0a\xc4\xe2\xe5\xa7\xe1\x66\x45\x0f\x0f\xf1\xbf\x46\x13\xbc\x68\x0a\x00\x00\x00\x26\x44\x0f\xc1\x4c\x1f\x7c\x0f\x18\x13\xc4\x63\x91\x5d\x3f\x00\x8f\x28\x48\xee\x1b\x68", 55); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x3000); 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; } :359: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[4], /*options=*/9, /*deadline=*/r[2], /*args=*/0x20021700, /*actual_bytes=*/0x20021740, /*actual_handles=*/0x20021780); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1869857804 -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.40s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/9 (1.01s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/2 (1.24s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/8 (1.24s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 19.294s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email 0.016s ok github.com/google/syzkaller/pkg/email/lore 0.012s ok github.com/google/syzkaller/pkg/host 21.252s ok github.com/google/syzkaller/pkg/html 0.011s ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image (cached) ok github.com/google/syzkaller/pkg/instance 3.768s ok github.com/google/syzkaller/pkg/ipc 19.502s ok github.com/google/syzkaller/pkg/kconfig 0.465s ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 2.100s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 15.456s ok github.com/google/syzkaller/pkg/repro 3.172s ok github.com/google/syzkaller/pkg/runtest 49.454s ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem 0.016s ok github.com/google/syzkaller/pkg/subsystem/linux 0.031s ok github.com/google/syzkaller/pkg/subsystem/lists 0.262s ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs 5.684s ok github.com/google/syzkaller/prog 12.217s ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux (cached) ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci 3.002s ok github.com/google/syzkaller/syz-fuzzer 0.334s ok github.com/google/syzkaller/syz-hub 0.023s ok github.com/google/syzkaller/syz-hub/state 0.079s ok github.com/google/syzkaller/syz-manager 4.005s ok github.com/google/syzkaller/syz-verifier 2.808s ok github.com/google/syzkaller/tools/syz-kconf 0.011s ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/parser (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/proggen (cached) ok github.com/google/syzkaller/vm 10.805s ok github.com/google/syzkaller/vm/isolated 2.841s ok github.com/google/syzkaller/vm/proxyapp 5.163s ok github.com/google/syzkaller/vm/vmimpl 3.619s FAIL