? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app (cached) ? 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/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ? github.com/google/syzkaller/pkg/report/crash [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/signal [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin [no test files] ? github.com/google/syzkaller/sys/darwin/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ? github.com/google/syzkaller/syz-runner [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-build [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fillreports [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-imagegen [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ? github.com/google/syzkaller/tools/syz-lore [no test files] ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-minconfig [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-query-subsystems [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbed [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/cuttlefish [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/proxyapp/mocks [no test files] ? github.com/google/syzkaller/vm/proxyapp/proxyrpc [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ? github.com/google/syzkaller/vm/starnix [no test files] ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] ok github.com/google/syzkaller/executor 2.283s ok github.com/google/syzkaller/pkg/asset (cached) ok github.com/google/syzkaller/pkg/ast 0.883s ok github.com/google/syzkaller/pkg/auth (cached) ok github.com/google/syzkaller/pkg/bisect (cached) ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build (cached) ok github.com/google/syzkaller/pkg/compiler 3.491s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover (cached) ok github.com/google/syzkaller/pkg/cover/backend (cached) --- FAIL: TestGenerate (6.37s) --- FAIL: TestGenerate/fuchsia/amd64 (0.09s) testutil.go:33: seed=1692189051742051664 testutil.go:33: seed=1692189051835468289 --- FAIL: TestGenerate/fuchsia/amd64/12 (1.29s) 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_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :404: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3979340896 -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 (1.29s) 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_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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; *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); syz_future_time(/*when=*/1); syz_job_default(); syz_mmap(/*addr=*/0x20ffb000, /*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; } :255: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2014901604 -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 (1.28s) 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_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :402: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1743777306 -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/9 (1.29s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:9223372036854775807 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :402: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1860466306 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/3 (1.33s) 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_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :402: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor752450159 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/2 (1.35s) csource_test.go:150: opts: {Threaded:true Repeat:false RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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 loop(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :396: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor291445366 -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 (1.36s) 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_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :390: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3830129051 -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 (1.11s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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; } #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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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(); loop(); return 0; } :396: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1956827916 -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 (1.12s) 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_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :402: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor525011046 -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 (1.13s) 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_channel_call$fuchsia_net_NameLookupLookupHostname(0x0, 0x0, 0x7fffffffffffffff, &(0x7f00000100c0)={&(0x7f0000000000)={{}, @ipv6InLine={0x2, {"c79bfe492eebd4f0bd9304840f9951d9"}}, @ipv6OutOfLine}, &(0x7f0000000040), &(0x7f0000000080), &(0x7f0000010080), 0x24, 0x0, 0x10000}, &(0x7f0000010100), &(0x7f0000010140)) (fail_nth: 1) zx_channel_call$fuchsia_io_FileRead(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020240)={&(0x7f0000010180)={{}, 0x101}, &(0x7f00000101c0), &(0x7f0000010200), &(0x7f0000020200), 0x18, 0x0, 0x10000}, &(0x7f0000020280), &(0x7f00000202c0)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogMetricEvents(0x0, 0x0, r0, &(0x7f0000030480)={&(0x7f0000020300)={{}, {0x7fffffffffffffff, 0xffffffffffffffff}, {[{0xfffffff7, {0xffffffff00000001, 0xffffffffffffffff}, @integer_value={0x2, 0x20}}, {0xe0, {0x692, 0xffffffffffffffff}, @count={0x1, 0x5}}, {0xa3, {0x101, 0xffffffffffffffff}, @count={0x1, 0x4ed5}}], [{[0xc8, 0x10000, 0x10001, 0x7fff, 0x3a3c, 0x2, 0x1, 0xfffffffc, 0x90a]}, {[0x4000, 0x8]}, {[0x3]}, {[0x3, 0x6]}, {[0x4, 0x0, 0x4, 0x9, 0x80000001, 0x7c8]}]}}, &(0x7f0000020400)={[{}, {}, {}]}, &(0x7f0000020440), &(0x7f0000030440), 0xf4, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_vmo_create_contiguous(0x0, 0x4, 0x10000, &(0x7f0000030600)=0x0) r2 = syz_process_self() zx_channel_create$fuchsia_io_DirectoryWatcher(0x0, &(0x7f0000030640), &(0x7f0000030680)=0x0) zx_channel_call_etc(0x0, 0x6, r0, &(0x7f0000030780)={&(0x7f0000030540)="8dec50655b908b9aa0172b4e40c658f18ce5a487c60bb6e37866e057ac8bdada7ef4a87793566cf8b02967917df8bcab492ef2ca54a941c2c0e2525ce9f8eba29ff8d89f515b2ef918535699820ea6b5cf4f366f1cab50f30cbac4ba4b8a60d0219863f347e906afd5fa7337a5eb00283f9093111c0944920f58c80ff09e01bc2a2122ef59b1378898167f8b8f67c95729ab293c5816447e235869c75b9c0c4da76ead337daa7228eeef2cb8197776a714f01eeeaa070bba7918", &(0x7f00000306c0)=[0x0, r1, 0x0, 0x0, 0x0, r2, 0x0, r3, 0x0, 0x0], &(0x7f0000030700)=""/62, &(0x7f0000030740)=[0x0, 0x0, 0x0], 0xba, 0xa, 0x3e, 0x3}, &(0x7f00000307c0), &(0x7f0000030800)) r5 = syz_future_time(0x0) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r4, 0x0, r5, &(0x7f0000050d80)={&(0x7f0000030840)={{}, {0xffffffff, 0xffffffff, {0x40}}, {{'\x00'}}}, &(0x7f0000040d00), &(0x7f0000040d40), &(0x7f0000050d40), 0x30, 0x2, 0x10000, 0x4}, &(0x7f0000050dc0), &(0x7f0000050e00)) syz_execute_func(&(0x7f0000000000)="c481fc51a1000000008f2840ed6dfefec441716b12f3400f52d8c441f810aa000000008fa978d1c48f6808a2f2f3d9fbf240e46dc4c1d0578d18000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/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: *(uint64_t*)0x200100c0 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x17582c9400000000; *(uint32_t*)0x20000010 = 2; memcpy((void*)0x20000014, "\xc7\x9b\xfe\x49\x2e\xeb\xd4\xf0\xbd\x93\x04\x84\x0f\x99\x51\xd9", 16); *(uint64_t*)0x200100c8 = 0x20000040; *(uint64_t*)0x200100d0 = 0x20000080; *(uint64_t*)0x200100d8 = 0x20010080; *(uint32_t*)0x200100e0 = 0x24; *(uint32_t*)0x200100e4 = 0; *(uint32_t*)0x200100e8 = 0x10000; *(uint32_t*)0x200100ec = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x200100c0, /*actual_bytes=*/0x20010100, /*actual_handles=*/0x20010140); break; case 1: *(uint64_t*)0x20020240 = 0x20010180; *(uint32_t*)0x20010180 = 0; memset((void*)0x20010184, 0, 3); *(uint8_t*)0x20010187 = 1; *(uint64_t*)0x20010188 = 0x25f7418400000000; *(uint64_t*)0x20010190 = 0x101; *(uint64_t*)0x20020248 = 0x200101c0; *(uint64_t*)0x20020250 = 0x20010200; *(uint64_t*)0x20020258 = 0x20020200; *(uint32_t*)0x20020260 = 0x18; *(uint32_t*)0x20020264 = 0; *(uint32_t*)0x20020268 = 0x10000; *(uint32_t*)0x2002026c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020240, /*actual_bytes=*/0x20020280, /*actual_handles=*/0x200202c0); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x20030480 = 0x20020300; *(uint32_t*)0x20020300 = 0; memset((void*)0x20020304, 0, 3); *(uint8_t*)0x20020307 = 1; *(uint64_t*)0x20020308 = 0x6a75708d00000000; *(uint64_t*)0x20020310 = 0x7fffffffffffffff; *(uint64_t*)0x20020318 = -1; *(uint32_t*)0x20020320 = 0xfffffff7; *(uint64_t*)0x20020324 = 0xffffffff00000001; *(uint64_t*)0x2002032c = -1; *(uint32_t*)0x20020334 = 2; *(uint64_t*)0x2002033c = 0x20; *(uint32_t*)0x2002034c = 0xe0; *(uint64_t*)0x20020350 = 0x692; *(uint64_t*)0x20020358 = -1; *(uint32_t*)0x20020360 = 1; *(uint64_t*)0x20020368 = 5; *(uint32_t*)0x20020378 = 0xa3; *(uint64_t*)0x2002037c = 0x101; *(uint64_t*)0x20020384 = -1; *(uint32_t*)0x2002038c = 1; *(uint64_t*)0x20020394 = 0x4ed5; *(uint32_t*)0x200203a4 = 0xc8; *(uint32_t*)0x200203a8 = 0x10000; *(uint32_t*)0x200203ac = 0x10001; *(uint32_t*)0x200203b0 = 0x7fff; *(uint32_t*)0x200203b4 = 0x3a3c; *(uint32_t*)0x200203b8 = 2; *(uint32_t*)0x200203bc = 1; *(uint32_t*)0x200203c0 = 0xfffffffc; *(uint32_t*)0x200203c4 = 0x90a; *(uint32_t*)0x200203c8 = 0x4000; *(uint32_t*)0x200203cc = 8; *(uint32_t*)0x200203d0 = 3; *(uint32_t*)0x200203d4 = 3; *(uint32_t*)0x200203d8 = 6; *(uint32_t*)0x200203dc = 4; *(uint32_t*)0x200203e0 = 0; *(uint32_t*)0x200203e4 = 4; *(uint32_t*)0x200203e8 = 9; *(uint32_t*)0x200203ec = 0x80000001; *(uint32_t*)0x200203f0 = 0x7c8; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0xf4; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmo_create_contiguous))(/*bti=*/0, /*size=*/4, /*alignment_log2=*/0x10000, /*out=*/0x20030600); if (res == ZX_OK) r[1] = *(uint32_t*)0x20030600; break; case 5: res = -1; res = syz_process_self(); if ((int)res != -1) r[2] = res; break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20030640, /*out1=*/0x20030680); if (res == ZX_OK) r[3] = *(uint32_t*)0x20030680; break; case 7: *(uint64_t*)0x20030780 = 0x20030540; memcpy((void*)0x20030540, "\x8d\xec\x50\x65\x5b\x90\x8b\x9a\xa0\x17\x2b\x4e\x40\xc6\x58\xf1\x8c\xe5\xa4\x87\xc6\x0b\xb6\xe3\x78\x66\xe0\x57\xac\x8b\xda\xda\x7e\xf4\xa8\x77\x93\x56\x6c\xf8\xb0\x29\x67\x91\x7d\xf8\xbc\xab\x49\x2e\xf2\xca\x54\xa9\x41\xc2\xc0\xe2\x52\x5c\xe9\xf8\xeb\xa2\x9f\xf8\xd8\x9f\x51\x5b\x2e\xf9\x18\x53\x56\x99\x82\x0e\xa6\xb5\xcf\x4f\x36\x6f\x1c\xab\x50\xf3\x0c\xba\xc4\xba\x4b\x8a\x60\xd0\x21\x98\x63\xf3\x47\xe9\x06\xaf\xd5\xfa\x73\x37\xa5\xeb\x00\x28\x3f\x90\x93\x11\x1c\x09\x44\x92\x0f\x58\xc8\x0f\xf0\x9e\x01\xbc\x2a\x21\x22\xef\x59\xb1\x37\x88\x98\x16\x7f\x8b\x8f\x67\xc9\x57\x29\xab\x29\x3c\x58\x16\x44\x7e\x23\x58\x69\xc7\x5b\x9c\x0c\x4d\xa7\x6e\xad\x33\x7d\xaa\x72\x28\xee\xef\x2c\xb8\x19\x77\x76\xa7\x14\xf0\x1e\xee\xaa\x07\x0b\xba\x79\x18", 186); *(uint64_t*)0x20030788 = 0x200306c0; *(uint32_t*)0x200306c0 = 0; *(uint32_t*)0x200306c4 = r[1]; *(uint32_t*)0x200306c8 = 0; *(uint32_t*)0x200306cc = 0; *(uint32_t*)0x200306d0 = 0; *(uint32_t*)0x200306d4 = r[2]; *(uint32_t*)0x200306d8 = 0; *(uint32_t*)0x200306dc = r[3]; *(uint32_t*)0x200306e0 = 0; *(uint32_t*)0x200306e4 = 0; *(uint64_t*)0x20030790 = 0x20030700; *(uint64_t*)0x20030798 = 0x20030740; *(uint32_t*)0x200307a0 = 0xba; *(uint32_t*)0x200307a4 = 0xa; *(uint32_t*)0x200307a8 = 0x3e; *(uint32_t*)0x200307ac = 3; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); if (res == ZX_OK) r[4] = *(uint32_t*)0x20030744; break; case 8: res = -1; res = syz_future_time(/*when=*/0); if ((int)res != -1) r[5] = res; break; case 9: *(uint64_t*)0x20050d80 = 0x20030840; *(uint32_t*)0x20030840 = 0; memset((void*)0x20030844, 0, 3); *(uint8_t*)0x20030847 = 1; *(uint64_t*)0x20030848 = 0x4fcfbc1100000000; *(uint32_t*)0x20030850 = -1; *(uint32_t*)0x20030854 = -1; *(uint64_t*)0x20030858 = 0x40; *(uint64_t*)0x20030860 = 0; memset((void*)0x20030868, 0, 1); *(uint64_t*)0x20050d88 = 0x20040d00; *(uint32_t*)0x20040d00 = 0; *(uint32_t*)0x20040d04 = 0; *(uint64_t*)0x20050d90 = 0x20040d40; *(uint64_t*)0x20050d98 = 0x20050d40; *(uint32_t*)0x20050da0 = 0x30; *(uint32_t*)0x20050da4 = 2; *(uint32_t*)0x20050da8 = 0x10000; *(uint32_t*)0x20050dac = 4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[4], /*options=*/0, /*deadline=*/r[5], /*args=*/0x20050d80, /*actual_bytes=*/0x20050dc0, /*actual_handles=*/0x20050e00); break; case 10: memcpy((void*)0x20000000, "\xc4\x81\xfc\x51\xa1\x00\x00\x00\x00\x8f\x28\x40\xed\x6d\xfe\xfe\xc4\x41\x71\x6b\x12\xf3\x40\x0f\x52\xd8\xc4\x41\xf8\x10\xaa\x00\x00\x00\x00\x8f\xa9\x78\xd1\xc4\x8f\x68\x08\xa2\xf2\xf3\xd9\xfb\xf2\x40\xe4\x6d\xc4\xc1\xd0\x57\x8d\x18\x00\x00\x00", 61); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffb000, /*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; } :406: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=*/0, /*options=*/6, /*deadline=*/r[0], /*args=*/0x20030780, /*actual_bytes=*/0x200307c0, /*actual_handles=*/0x20030800); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor400950126 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/8 (1.16s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/5 (1.02s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/13 (1.07s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/4 (1.08s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 9.239s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ok github.com/google/syzkaller/pkg/email/lore (cached) ok github.com/google/syzkaller/pkg/host (cached) ok github.com/google/syzkaller/pkg/html (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image (cached) ok github.com/google/syzkaller/pkg/instance (cached) ok github.com/google/syzkaller/pkg/ipc (cached) ok github.com/google/syzkaller/pkg/kconfig (cached) ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig (cached) ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report (cached) ok github.com/google/syzkaller/pkg/repro (cached) ok github.com/google/syzkaller/pkg/runtest (cached) ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem (cached) ok github.com/google/syzkaller/pkg/subsystem/linux (cached) ok github.com/google/syzkaller/pkg/subsystem/lists (cached) ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ok github.com/google/syzkaller/prog (cached) 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 (cached) ok github.com/google/syzkaller/syz-fuzzer (cached) ok github.com/google/syzkaller/syz-hub (cached) ok github.com/google/syzkaller/syz-hub/state (cached) ok github.com/google/syzkaller/syz-manager (cached) ok github.com/google/syzkaller/syz-verifier (cached) ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/parser (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/proggen (cached) ok github.com/google/syzkaller/vm (cached) ok github.com/google/syzkaller/vm/isolated (cached) ok github.com/google/syzkaller/vm/proxyapp (cached) ok github.com/google/syzkaller/vm/vmimpl (cached) FAIL