? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app 0.084s ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ? github.com/google/syzkaller/pkg/html/pages [no test files] ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ok github.com/google/syzkaller/executor 1.691s ok github.com/google/syzkaller/pkg/asset 0.061s ok github.com/google/syzkaller/pkg/ast 0.463s ok github.com/google/syzkaller/pkg/auth (cached) ? github.com/google/syzkaller/pkg/report/crash [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/signal [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ok github.com/google/syzkaller/pkg/bisect 38.734s ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build 3.757s ok github.com/google/syzkaller/pkg/compiler 2.643s ok github.com/google/syzkaller/pkg/config 0.003s ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin [no test files] ? github.com/google/syzkaller/sys/darwin/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ? github.com/google/syzkaller/syz-runner [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-build [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/cover 71.965s ok github.com/google/syzkaller/pkg/cover/backend 0.483s --- FAIL: TestGenerate (51.61s) --- FAIL: TestGenerate/fuchsia/amd64 (0.04s) testutil.go:33: seed=1693833433832055500 testutil.go:33: seed=1693833433873300377 --- FAIL: TestGenerate/fuchsia/amd64/3 (1.01s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:10 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :278:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2377045951 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/6 (1.01s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:10 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :278:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor921162364 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/0 (1.01s) csource_test.go:150: opts: {Threaded:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_one(void) { intptr_t res = 0; *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); syz_future_time(/*when=*/0); syz_job_default(); syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); syz_process_self(); syz_thread_self(); syz_vmar_root_self(); } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :145:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1625809652 -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.98s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :280:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3671225177 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/2 (1.01s) csource_test.go:150: opts: {Threaded:true Repeat:false RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void loop(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } uint64_t r[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :272:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1900216431 -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.99s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); loop(); return 0; } :272:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor302880558 -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.99s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:true LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); fprintf(stderr, "### call=0 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); fprintf(stderr, "### call=1 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); fprintf(stderr, "### call=2 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); fprintf(stderr, "### call=3 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); fprintf(stderr, "### call=4 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 5: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); fprintf(stderr, "### call=5 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 6: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); fprintf(stderr, "### call=6 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 7: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); fprintf(stderr, "### call=7 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 8: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); fprintf(stderr, "### call=8 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 9: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); fprintf(stderr, "### call=9 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); res = -1; errno = EFAULT; res = syz_execute_func(/*text=*/0x20000000); fprintf(stderr, "### call=10 errno=%u\n", res == -1 ? errno : 0); break; case 11: res = -1; errno = EFAULT; res = syz_future_time(/*when=*/0); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; case 12: res = -1; errno = EFAULT; res = syz_job_default(); fprintf(stderr, "### call=12 errno=%u\n", res == -1 ? errno : 0); break; case 13: res = -1; errno = EFAULT; res = syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); fprintf(stderr, "### call=13 errno=%u\n", res == -1 ? errno : 0); break; case 14: res = -1; errno = EFAULT; res = syz_process_self(); fprintf(stderr, "### call=14 errno=%u\n", res == -1 ? errno : 0); break; case 15: res = -1; errno = EFAULT; res = syz_thread_self(); fprintf(stderr, "### call=15 errno=%u\n", res == -1 ? errno : 0); break; case 16: res = -1; errno = EFAULT; res = syz_vmar_root_self(); fprintf(stderr, "### call=16 errno=%u\n", res == -1 ? errno : 0); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :280:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1895205300 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/4 (0.99s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:1 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :278:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1673830414 -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.99s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:false HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); do_sandbox_none(); return 0; } :266:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2522218229 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/9 (1.02s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/14 (0.99s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/12 (1.02s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_channel_call_etc(0x0, 0x8, 0x7fffffffffffffff, &(0x7f0000000280)={&(0x7f0000000000)="9bf996142bf68cd9a0ecf158065a4964e75501fbb104c08771b209b24dc42fa1b27396f23a262f58ac1b1822d28113e10dbb1e82404e21a1926d265a7d01bef829dbfde92387aae1d5705d31c43be25fd36075b827b765a69c8581a6fd5452be3e19d93c86000f93c1acf2fcaf072a8ef68315440b69e899caaedc60488afbc652cfc3b6c92b9efd8d666707a5ad3bd4e0b62a809797faf9f452c11fe55655682b50d634b8044054a29a78c40ab5fa6cf3c93870af8d2b4f2e847ecb1baa6efc1474fe092acda8c89e51a394cf562c17da26c911689218abc51990ace14e72bd1d562eeaae090df4287ef885e24d646b34", &(0x7f0000000100)=[0x0], &(0x7f0000000140)=""/255, &(0x7f0000000240)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0xf1, 0x1, 0xff, 0x6}, &(0x7f00000002c0), &(0x7f0000000300)) (fail_nth: 1) zx_object_get_info$ZX_INFO_VMAR(r1, 0x7, &(0x7f0000000340), 0x10, &(0x7f0000000380), &(0x7f00000003c0)) (async) zx_channel_call$fuchsia_process_LauncherCreateWithoutStarting(r2, 0x0, 0x0, &(0x7f00000104c0)={&(0x7f0000000400)={{}, {0xffffffff, 0xffffffff, {0x10000, 0xffffffffffffffff}}}, &(0x7f0000000440)={{r2, r0}}, &(0x7f0000000480), &(0x7f0000010480)={{0x0, 0x0, 0x0}}, 0x28, 0x2, 0x10000, 0x4}, &(0x7f0000010500), &(0x7f0000010540)) (rerun: 4) zx_channel_create(0x0, &(0x7f0000010580), &(0x7f00000105c0)=0x0) zx_channel_read$fuchsia_io_DirectoryAdminOnOpen(r6, 0x0, &(0x7f0000010600), 0x10000, &(0x7f0000020600)={@device}, 0x4, &(0x7f0000020640), &(0x7f0000020680)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000206c0), 0x10, &(0x7f0000020700), &(0x7f0000020740)) zx_object_signal(r6, 0x80000001, 0x7fff) zx_object_wait_one(r5, 0x8, 0x0, &(0x7f0000020780)) zx_object_get_info$ZX_INFO_VMO(r4, 0x10000017, &(0x7f00000207c0), 0x70, &(0x7f0000020840), &(0x7f0000020880)) zx_object_get_info$ZX_INFO_VMAR(r3, 0x7, &(0x7f00000208c0), 0x10, &(0x7f0000020900), &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="45db09c421717dc20f0f3eb62667f346e013c4e17951810000000040ddccc4a20993943bfc000000c4c3fd08ae09250000d6c462c5ba6dbb8fe97c809a54580831") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000800000/0x800000)=nil, 0x800000) 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[7] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: *(uint64_t*)0x20000280 = 0x20000000; memcpy((void*)0x20000000, "\x9b\xf9\x96\x14\x2b\xf6\x8c\xd9\xa0\xec\xf1\x58\x06\x5a\x49\x64\xe7\x55\x01\xfb\xb1\x04\xc0\x87\x71\xb2\x09\xb2\x4d\xc4\x2f\xa1\xb2\x73\x96\xf2\x3a\x26\x2f\x58\xac\x1b\x18\x22\xd2\x81\x13\xe1\x0d\xbb\x1e\x82\x40\x4e\x21\xa1\x92\x6d\x26\x5a\x7d\x01\xbe\xf8\x29\xdb\xfd\xe9\x23\x87\xaa\xe1\xd5\x70\x5d\x31\xc4\x3b\xe2\x5f\xd3\x60\x75\xb8\x27\xb7\x65\xa6\x9c\x85\x81\xa6\xfd\x54\x52\xbe\x3e\x19\xd9\x3c\x86\x00\x0f\x93\xc1\xac\xf2\xfc\xaf\x07\x2a\x8e\xf6\x83\x15\x44\x0b\x69\xe8\x99\xca\xae\xdc\x60\x48\x8a\xfb\xc6\x52\xcf\xc3\xb6\xc9\x2b\x9e\xfd\x8d\x66\x67\x07\xa5\xad\x3b\xd4\xe0\xb6\x2a\x80\x97\x97\xfa\xf9\xf4\x52\xc1\x1f\xe5\x56\x55\x68\x2b\x50\xd6\x34\xb8\x04\x40\x54\xa2\x9a\x78\xc4\x0a\xb5\xfa\x6c\xf3\xc9\x38\x70\xaf\x8d\x2b\x4f\x2e\x84\x7e\xcb\x1b\xaa\x6e\xfc\x14\x74\xfe\x09\x2a\xcd\xa8\xc8\x9e\x51\xa3\x94\xcf\x56\x2c\x17\xda\x26\xc9\x11\x68\x92\x18\xab\xc5\x19\x90\xac\xe1\x4e\x72\xbd\x1d\x56\x2e\xea\xae\x09\x0d\xf4\x28\x7e\xf8\x85\xe2\x4d\x64\x6b\x34", 241); *(uint64_t*)0x20000288 = 0x20000100; *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000290 = 0x20000140; *(uint64_t*)0x20000298 = 0x20000240; *(uint32_t*)0x200002a0 = 0xf1; *(uint32_t*)0x200002a4 = 1; *(uint32_t*)0x200002a8 = 0xff; *(uint32_t*)0x200002ac = 6; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); if (res == ZX_OK) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000248; r[2] = *(uint32_t*)0x2000024c; r[3] = *(uint32_t*)0x20000250; r[4] = *(uint32_t*)0x20000254; } break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/7, /*buffer=*/0x20000340, /*buffer_size=*/0x10, /*actual=*/0x20000380, /*avail=*/0x200003c0); break; case 2: *(uint64_t*)0x200104c0 = 0x20000400; *(uint32_t*)0x20000400 = 0; memset((void*)0x20000404, 0, 3); *(uint8_t*)0x20000407 = 1; *(uint64_t*)0x20000408 = 0x4fcfbc1100000000; *(uint32_t*)0x20000410 = -1; *(uint32_t*)0x20000414 = -1; *(uint64_t*)0x20000418 = 0x10000; *(uint64_t*)0x20000420 = -1; *(uint64_t*)0x200104c8 = 0x20000440; *(uint32_t*)0x20000440 = r[2]; *(uint32_t*)0x20000444 = r[0]; *(uint64_t*)0x200104d0 = 0x20000480; *(uint64_t*)0x200104d8 = 0x20010480; *(uint32_t*)0x200104e0 = 0x28; *(uint32_t*)0x200104e4 = 2; *(uint32_t*)0x200104e8 = 0x10000; *(uint32_t*)0x200104ec = 4; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); { 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))(/*handle=*/r[2], /*options=*/0, /*deadline=*/0, /*args=*/0x200104c0, /*actual_bytes=*/0x20010500, /*actual_handles=*/0x20010540); } } if (res == ZX_OK) r[5] = *(uint32_t*)0x20010488; break; case 3: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010580, /*out1=*/0x200105c0); if (res == ZX_OK) r[6] = *(uint32_t*)0x200105c0; break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_read))(/*handle=*/r[6], /*options=*/0, /*bytes=*/0x20010600, /*num_bytes=*/0x10000, /*handles=*/0x20020600, /*num_handles=*/4, /*actual_bytes=*/0x20020640, /*actual_handles=*/0x20020680); break; case 5: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200206c0, /*buffer_size=*/0x10, /*actual=*/0x20020700, /*avail=*/0x20020740); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_object_signal))(/*handle=*/r[6], /*clear_mask=*/0x80000001, /*set_mask=*/0x7fff); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_wait_one))(/*handle=*/r[5], /*signals=*/8, /*deadline=*/0, /*observed=*/0x20020780); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[4], /*topic=*/0x10000017, /*buffer=*/0x200207c0, /*buffer_size=*/0x70, /*actual=*/0x20020840, /*avail=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[3], /*topic=*/7, /*buffer=*/0x200208c0, /*buffer_size=*/0x10, /*actual=*/0x20020900, /*avail=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x45\xdb\x09\xc4\x21\x71\x7d\xc2\x0f\x0f\x3e\xb6\x26\x67\xf3\x46\xe0\x13\xc4\xe1\x79\x51\x81\x00\x00\x00\x00\x40\xdd\xcc\xc4\xa2\x09\x93\x94\x3b\xfc\x00\x00\x00\xc4\xc3\xfd\x08\xae\x09\x25\x00\x00\xd6\xc4\x62\xc5\xba\x6d\xbb\x8f\xe9\x7c\x80\x9a\x54\x58\x08\x31", 65); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/0); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20800000, /*len=*/0x800000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :280:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/8, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20000280, /*actual_bytes=*/0x200002c0, /*actual_handles=*/0x20000300); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor575971881 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/1 (0.99s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/8 (0.99s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 66.791s ok github.com/google/syzkaller/pkg/db 1.327s ok github.com/google/syzkaller/pkg/email (cached) ok github.com/google/syzkaller/pkg/email/lore (cached) ok github.com/google/syzkaller/pkg/host 47.308s ok github.com/google/syzkaller/pkg/html 0.007s ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image 1.606s ok github.com/google/syzkaller/pkg/instance 3.120s ok github.com/google/syzkaller/pkg/ipc 71.850s ok github.com/google/syzkaller/pkg/kconfig 0.335s ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 2.134s ok github.com/google/syzkaller/pkg/osutil 0.082s ok github.com/google/syzkaller/pkg/report 15.724s ok github.com/google/syzkaller/pkg/repro 3.269s ok github.com/google/syzkaller/pkg/runtest 79.497s ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem 0.004s ok github.com/google/syzkaller/pkg/subsystem/linux 0.017s ok github.com/google/syzkaller/pkg/subsystem/lists 0.119s ok github.com/google/syzkaller/pkg/symbolizer 0.022s ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs 31.516s ok github.com/google/syzkaller/prog 12.875s ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux 0.101s ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci 3.200s ok github.com/google/syzkaller/syz-fuzzer 0.265s ok github.com/google/syzkaller/syz-hub 0.014s ok github.com/google/syzkaller/syz-hub/state 0.031s ok github.com/google/syzkaller/syz-manager 4.386s ok github.com/google/syzkaller/syz-verifier 3.255s ok github.com/google/syzkaller/tools/syz-kconf 0.010s ok github.com/google/syzkaller/tools/syz-linter 18.463s ok github.com/google/syzkaller/tools/syz-trace2syz/parser 0.010s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 0.173s ok github.com/google/syzkaller/vm 11.884s ok github.com/google/syzkaller/vm/isolated 14.892s ok github.com/google/syzkaller/vm/proxyapp 16.935s ok github.com/google/syzkaller/vm/vmimpl 11.558s FAIL