? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app 0.097s ? 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] ok github.com/google/syzkaller/executor 2.403s ok github.com/google/syzkaller/pkg/asset 0.090s ok github.com/google/syzkaller/pkg/ast 0.620s ok github.com/google/syzkaller/pkg/auth (cached) ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [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/trusty [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ? github.com/google/syzkaller/syz-runner [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-build [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fillreports [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-imagegen [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ? github.com/google/syzkaller/tools/syz-lore [no test files] ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-minconfig [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-query-subsystems [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbed [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/cuttlefish [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/proxyapp/mocks [no test files] ? github.com/google/syzkaller/vm/proxyapp/proxyrpc [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ? github.com/google/syzkaller/vm/starnix [no test files] ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] ok github.com/google/syzkaller/pkg/bisect 19.777s ok github.com/google/syzkaller/pkg/build 14.430s ok github.com/google/syzkaller/pkg/compiler 4.071s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover (cached) ok github.com/google/syzkaller/pkg/cover/backend 0.664s --- FAIL: TestGenerate (29.12s) --- FAIL: TestGenerate/fuchsia/amd64 (0.10s) testutil.go:33: seed=1685009954319360082 testutil.go:33: seed=1685009954422659015 --- FAIL: TestGenerate/fuchsia/amd64/12 (0.17s) 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 UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :301: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2838603091 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/0 (0.17s) 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 UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_one(void) { intptr_t res = 0; *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); syz_future_time(0); syz_job_default(); syz_mmap(0x20ffa000, 0x3000); syz_process_self(); syz_thread_self(); syz_vmar_root_self(); } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :164: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3724710824 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/6 (0.14s) 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 UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :299: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2424125284 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/14 (0.15s) 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 UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :303: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor218027040 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/3 (0.13s) 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 UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :299: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2166002098 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/8 (0.14s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:-9223372036854775808 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :299: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3705578564 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/7 (0.14s) 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 UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); loop(); return 0; } :293: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2453127359 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/10 (0.15s) 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 UseTmpDir:false HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); do_sandbox_none(); return 0; } :287: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor4168412046 -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 (0.15s) 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 UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/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[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :299: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1161211533 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/5 (0.11s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call$fuchsia_ldsvc_LoaderLoadObject(0x0, 0x0, 0x0, &(0x7f0000010100)={&(0x7f0000000040)={{}, {0x101}, {'\xb6]+/+{!^'}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0)={0x0}, 0x28, 0x0, 0x10000, 0x1}, &(0x7f0000010140), &(0x7f0000010180)) (fail_nth: 1) zx_channel_call_etc(0x0, 0x7fff, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f00000101c0)="68590f76552868d0d0ed149f3de5129e53e2dab6ccb6a7a3659bf3676c06b2218fec1d92694577aa2701741904b5b42a15539d852e47efc0cf06f9957123ace7a8aee37ae57633385d20c1dfc519c12e04edd00a3ca345c6b12aeb16818e7223243ef65d70dbce929b61dee18cb7badec0545b03b289a16fe3b455c369c50cf985b1e51de92a4a089e0754264a26ec586d6b93c86204a68f12bc1762c83ce28bb70da540da0ea204ed4ef165e9f84577872d539188d91fbc9c4b038229bdcfbd15dc9f3d2766e04e87471ee3eb8a4f9da7cd728a2246a9e87685ac74216e1c57ab2cd7f120131fcabb1bf51c", &(0x7f00000102c0)=[0x0], &(0x7f0000010300)=""/241, &(0x7f0000010400)=[0x0], 0xec, 0x1, 0xf1, 0x1}, &(0x7f0000010480), &(0x7f00000104c0)) (async) zx_channel_call$fuchsia_process_LauncherLaunch(0x0, 0x0, 0x0, &(0x7f0000020580)={&(0x7f0000000000)={{}, {0x0, 0xffffffff, {0x9, 0xffffffffffffffff}}, {{']%'}}}, &(0x7f0000010500)={{r0, r1}}, &(0x7f0000010540), &(0x7f0000020540), 0x30, 0x2, 0x10000, 0x1}, &(0x7f00000205c0), &(0x7f0000020600)) (rerun: 4) zx_interrupt_wait(r1, &(0x7f0000020640)=0x0) zx_channel_call$fuchsia_io_NodeNodeGetFlags(r1, 0x0, r2, &(0x7f0000030740)={&(0x7f0000020680), &(0x7f00000206c0), &(0x7f0000020700), &(0x7f0000030700), 0x10, 0x0, 0x10000}, &(0x7f0000030780), &(0x7f00000307c0)) zx_channel_call$fuchsia_io_FileClose(r1, 0x0, r2, &(0x7f00000408c0)={&(0x7f0000030800), &(0x7f0000030840), &(0x7f0000030880), &(0x7f0000040880), 0x10, 0x0, 0x10000}, &(0x7f0000040900), &(0x7f0000040940)) r3 = zx_deadline_after(0xffff) zx_channel_call$fuchsia_cobalt_ControllerGetNumEventAggregatorRuns(0x0, 0x0, r3, &(0x7f0000050a40)={&(0x7f0000040980), &(0x7f00000409c0), &(0x7f0000040a00), &(0x7f0000050a00), 0x10, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) zx_channel_create$fuchsia_io_Node(0x0, &(0x7f0000050b00)=0x0, &(0x7f0000050b40)) zx_channel_call$fuchsia_io_NodeDescribe(r4, 0x0, 0x0, &(0x7f0000060d00)={&(0x7f0000050c40), &(0x7f0000050c80), &(0x7f0000050cc0), &(0x7f0000060cc0)={@tty}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000060d40), &(0x7f0000060d80)) syz_execute_func(&(0x7f0000000000)="64430f1832c4a2c9aaa56e5666668fa9d0933b3ef20f2c750033e98f8978825090c44251f7490fdbf1c4411210e70f0d445dce") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[5] = {0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20010100 = 0x20000040; *(uint32_t*)0x20000040 = 0; memset((void*)0x20000044, 0, 3); *(uint8_t*)0x20000047 = 1; *(uint64_t*)0x20000048 = 0x18d35e6000000000; *(uint64_t*)0x20000050 = 0x101; *(uint64_t*)0x20000058 = 0; memcpy((void*)0x20000060, "\266]+/+{!^", 8); *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x28; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 1; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20010100, 0x20010140, 0x20010180); if (res == ZX_OK) r[0] = *(uint32_t*)0x200100c0; break; case 1: *(uint64_t*)0x20010440 = 0x200101c0; memcpy((void*)0x200101c0, "\x68\x59\x0f\x76\x55\x28\x68\xd0\xd0\xed\x14\x9f\x3d\xe5\x12\x9e\x53\xe2\xda\xb6\xcc\xb6\xa7\xa3\x65\x9b\xf3\x67\x6c\x06\xb2\x21\x8f\xec\x1d\x92\x69\x45\x77\xaa\x27\x01\x74\x19\x04\xb5\xb4\x2a\x15\x53\x9d\x85\x2e\x47\xef\xc0\xcf\x06\xf9\x95\x71\x23\xac\xe7\xa8\xae\xe3\x7a\xe5\x76\x33\x38\x5d\x20\xc1\xdf\xc5\x19\xc1\x2e\x04\xed\xd0\x0a\x3c\xa3\x45\xc6\xb1\x2a\xeb\x16\x81\x8e\x72\x23\x24\x3e\xf6\x5d\x70\xdb\xce\x92\x9b\x61\xde\xe1\x8c\xb7\xba\xde\xc0\x54\x5b\x03\xb2\x89\xa1\x6f\xe3\xb4\x55\xc3\x69\xc5\x0c\xf9\x85\xb1\xe5\x1d\xe9\x2a\x4a\x08\x9e\x07\x54\x26\x4a\x26\xec\x58\x6d\x6b\x93\xc8\x62\x04\xa6\x8f\x12\xbc\x17\x62\xc8\x3c\xe2\x8b\xb7\x0d\xa5\x40\xda\x0e\xa2\x04\xed\x4e\xf1\x65\xe9\xf8\x45\x77\x87\x2d\x53\x91\x88\xd9\x1f\xbc\x9c\x4b\x03\x82\x29\xbd\xcf\xbd\x15\xdc\x9f\x3d\x27\x66\xe0\x4e\x87\x47\x1e\xe3\xeb\x8a\x4f\x9d\xa7\xcd\x72\x8a\x22\x46\xa9\xe8\x76\x85\xac\x74\x21\x6e\x1c\x57\xab\x2c\xd7\xf1\x20\x13\x1f\xca\xbb\x1b\xf5\x1c", 236); *(uint64_t*)0x20010448 = 0x200102c0; *(uint32_t*)0x200102c0 = 0; *(uint64_t*)0x20010450 = 0x20010300; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0xec; *(uint32_t*)0x20010464 = 1; *(uint32_t*)0x20010468 = 0xf1; *(uint32_t*)0x2001046c = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x20010400; break; case 2: *(uint64_t*)0x20020580 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0x26884d9d00000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = -1; *(uint64_t*)0x20000018 = 9; *(uint64_t*)0x20000020 = -1; memcpy((void*)0x20000028, "]%", 2); *(uint64_t*)0x20020588 = 0x20010500; *(uint32_t*)0x20010500 = r[0]; *(uint32_t*)0x20010504 = r[1]; *(uint64_t*)0x20020590 = 0x20010540; *(uint64_t*)0x20020598 = 0x20020540; *(uint32_t*)0x200205a0 = 0x30; *(uint32_t*)0x200205a4 = 2; *(uint32_t*)0x200205a8 = 0x10000; *(uint32_t*)0x200205ac = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0, 0x20020580, 0x200205c0, 0x20020600); } } break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_interrupt_wait))(r[1], 0x20020640); if (res == ZX_OK) r[2] = *(uint64_t*)0x20020640; break; case 4: *(uint64_t*)0x20030740 = 0x20020680; *(uint32_t*)0x20020680 = 0; memset((void*)0x20020684, 0, 3); *(uint8_t*)0x20020687 = 1; *(uint64_t*)0x20020688 = 0x3c24c22300000000; *(uint64_t*)0x20030748 = 0x200206c0; *(uint64_t*)0x20030750 = 0x20020700; *(uint64_t*)0x20030758 = 0x20030700; *(uint32_t*)0x20030760 = 0x10; *(uint32_t*)0x20030764 = 0; *(uint32_t*)0x20030768 = 0x10000; *(uint32_t*)0x2003076c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x20030740, 0x20030780, 0x200307c0); break; case 5: *(uint64_t*)0x200408c0 = 0x20030800; *(uint32_t*)0x20030800 = 0; memset((void*)0x20030804, 0, 3); *(uint8_t*)0x20030807 = 1; *(uint64_t*)0x20030808 = 0x52b9568700000000; *(uint64_t*)0x200408c8 = 0x20030840; *(uint64_t*)0x200408d0 = 0x20030880; *(uint64_t*)0x200408d8 = 0x20040880; *(uint32_t*)0x200408e0 = 0x10; *(uint32_t*)0x200408e4 = 0; *(uint32_t*)0x200408e8 = 0x10000; *(uint32_t*)0x200408ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[1], 0, r[2], 0x200408c0, 0x20040900, 0x20040940); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t))CAST(zx_deadline_after))(0xffff); if (res == ZX_OK) r[3] = res; break; case 7: *(uint64_t*)0x20050a40 = 0x20040980; *(uint32_t*)0x20040980 = 0; memset((void*)0x20040984, 0, 3); *(uint8_t*)0x20040987 = 1; *(uint64_t*)0x20040988 = 0x2ffed0e300000000; *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x10; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, r[3], 0x20050a40, 0x20050a80, 0x20050ac0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20050b00, 0x20050b40); if (res == ZX_OK) r[4] = *(uint32_t*)0x20050b00; break; case 9: *(uint64_t*)0x20060d00 = 0x20050c40; *(uint32_t*)0x20050c40 = 0; memset((void*)0x20050c44, 0, 3); *(uint8_t*)0x20050c47 = 1; *(uint64_t*)0x20050c48 = 0x1f62df5e00000000; *(uint64_t*)0x20060d08 = 0x20050c80; *(uint64_t*)0x20060d10 = 0x20050cc0; *(uint64_t*)0x20060d18 = 0x20060cc0; *(uint32_t*)0x20060d20 = 0x10; *(uint32_t*)0x20060d24 = 0; *(uint32_t*)0x20060d28 = 0x10000; *(uint32_t*)0x20060d2c = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(r[4], 0, 0, 0x20060d00, 0x20060d40, 0x20060d80); break; case 10: memcpy((void*)0x20000000, "\x64\x43\x0f\x18\x32\xc4\xa2\xc9\xaa\xa5\x6e\x56\x66\x66\x8f\xa9\xd0\x93\x3b\x3e\xf2\x0f\x2c\x75\x00\x33\xe9\x8f\x89\x78\x82\x50\x90\xc4\x42\x51\xf7\x49\x0f\xdb\xf1\xc4\x41\x12\x10\xe7\x0f\x0d\x44\x5d\xce", 51); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffa000, 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(0x20000000, 0x1000000); setup_fault(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :301: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))(0, 0x7fff, 0x7fffffffffffffff, 0x20010440, 0x20010480, 0x200104c0); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2564834289 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/13 (0.17s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/4 (0.13s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/2 (0.11s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/1 (0.10s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 31.077s 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 17.701s ok github.com/google/syzkaller/pkg/html 0.028s ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image (cached) ok github.com/google/syzkaller/pkg/instance 5.681s ok github.com/google/syzkaller/pkg/ipc (cached) ok github.com/google/syzkaller/pkg/kconfig 1.014s ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 4.700s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 19.048s ok github.com/google/syzkaller/pkg/repro 4.872s 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 12.920s 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 3.215s 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 3.865s ok github.com/google/syzkaller/syz-verifier 3.060s 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 9.797s ok github.com/google/syzkaller/vm/isolated 1.742s ok github.com/google/syzkaller/vm/proxyapp 4.124s ok github.com/google/syzkaller/vm/vmimpl 1.660s FAIL