? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ? github.com/google/syzkaller/pkg/html/pages [no test files] ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ? github.com/google/syzkaller/pkg/report/crash [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/signal [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ok github.com/google/syzkaller/executor 2.699s ok github.com/google/syzkaller/pkg/asset (cached) ok github.com/google/syzkaller/pkg/ast 1.049s ok github.com/google/syzkaller/pkg/auth (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin [no test files] ? github.com/google/syzkaller/sys/darwin/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ? github.com/google/syzkaller/syz-runner [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-build [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fillreports [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-imagegen [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ? github.com/google/syzkaller/tools/syz-lore [no test files] ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-minconfig [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-query-subsystems [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbed [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/cuttlefish [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/proxyapp/mocks [no test files] ? github.com/google/syzkaller/vm/proxyapp/proxyrpc [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ? github.com/google/syzkaller/vm/starnix [no test files] ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] ok github.com/google/syzkaller/pkg/bisect 64.499s ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build 5.921s ok github.com/google/syzkaller/pkg/compiler 5.600s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover 13.043s ok github.com/google/syzkaller/pkg/cover/backend 0.541s --- FAIL: TestGenerate (18.07s) --- FAIL: TestGenerate/fuchsia/amd64 (0.40s) testutil.go:33: seed=1690725070712785937 testutil.go:33: seed=1690725070857318078 --- FAIL: TestGenerate/fuchsia/amd64/6 (1.36s) 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_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 500); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :276:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :280:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1826909278 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/12 (1.91s) 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_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :278:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :282:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2689805066 -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.92s) 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_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_one(void) { intptr_t res = 0; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); syz_future_time(/*when=*/1); syz_job_default(); syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); syz_process_self(); syz_thread_self(); syz_vmar_root_self(); } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :139:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :143:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor758215697 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/14 (2.52s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:2 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2 + procid*16); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :280:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :284:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor130740012 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/10 (2.53s) 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_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); do_sandbox_none(); return 0; } :264:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :268:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1983593731 -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 (2.42s) 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_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { 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[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); fprintf(stderr, "### call=0 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); fprintf(stderr, "### call=1 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 2: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); 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))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); fprintf(stderr, "### call=3 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 4: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); 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))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); fprintf(stderr, "### call=5 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); fprintf(stderr, "### call=6 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); 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[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); fprintf(stderr, "### call=8 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); fprintf(stderr, "### call=9 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); res = -1; errno = EFAULT; res = syz_execute_func(/*text=*/0x20000000); fprintf(stderr, "### call=10 errno=%u\n", res == -1 ? errno : 0); break; case 11: res = -1; errno = EFAULT; res = syz_future_time(/*when=*/1); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; case 12: res = -1; errno = EFAULT; res = syz_job_default(); fprintf(stderr, "### call=12 errno=%u\n", res == -1 ? errno : 0); break; case 13: res = -1; errno = EFAULT; res = syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); fprintf(stderr, "### call=13 errno=%u\n", res == -1 ? errno : 0); break; case 14: res = -1; errno = EFAULT; res = syz_process_self(); fprintf(stderr, "### call=14 errno=%u\n", res == -1 ? errno : 0); break; case 15: res = -1; errno = EFAULT; res = syz_thread_self(); fprintf(stderr, "### call=15 errno=%u\n", res == -1 ? errno : 0); break; case 16: res = -1; errno = EFAULT; res = syz_vmar_root_self(); fprintf(stderr, "### call=16 errno=%u\n", res == -1 ? errno : 0); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :284:45: error: use of undeclared identifier 'zx_vcpu_enter' res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :289:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor592144670 -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 (2.56s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:9223372036854775807 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :276:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :280:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1769772111 -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 (2.55s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :276:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :280:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2728984264 -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 (2.57s) 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_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void 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[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :270:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :274:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2648791199 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/8 (2.59s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:-9223372036854775808 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_port_create(0x0, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_port_cancel(r0, 0x0, 0xa) (async) zx_vcpu_enter(r0, &(0x7f0000000040)={0x0, 0x0, 0x0, @page_request}) (rerun: 4) zx_object_get_property$ZX_PROP_EXCEPTION_STATE(r0, 0x10, &(0x7f0000000080), 0x4) zx_object_get_info$ZX_INFO_JOB_CHILDREN(0x0, 0x8, &(0x7f00000000c0)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x48, &(0x7f0000000140), &(0x7f0000000180)) zx_system_get_event(0x0, 0x3, &(0x7f00000001c0)=0x0) zx_channel_call$fuchsia_io_DirectoryGetToken(r1, 0x0, 0x0, &(0x7f00000102c0)={&(0x7f0000000200), &(0x7f0000000240), &(0x7f0000000280), &(0x7f0000010280), 0x10, 0x0, 0x10000, 0x1}, &(0x7f0000010300), &(0x7f0000010340)) zx_fifo_write(r1, 0xffffffffffffff46, &(0x7f0000010380)="d7074930ee6f10438baec2446fa08a809fa97772cdf3a5666a5b8de3f1e320e9b7c3008227214c8205fb9327ddc59a5c1c3cffe2676dfa6deb4d32c5a82601a03f5e8f8e19650a41f8c3a660468ad98890d64e4917b7a3342972832c9f9bc6c761485e2d23119c507683b606cae54397bd8e708d001c529cc46fcf8aa30d6971c8c070f8a93a91aa420780a4d98ae6fdd80b13728e57ba4ea4a6d63b48173dc731ea66b120454bb2f91b1763b55ffff2ce1a0e28c3c9ec3133f5ba39af85ffb230bd57a3e447a7b79661c5bc4dd5c98ab4a6d7070e11a81a46e93928d5bd58cc05873b8ffbb279daab61de212d4ba5fc083317e32eea471c4f27fd", 0xfb, &(0x7f0000010480)) zx_object_get_info$ZX_INFO_HANDLE_TABLE(r0, 0x1b, &(0x7f00000104c0)={0x0, 0x0}, 0x28, &(0x7f0000010500), &(0x7f0000010540)) zx_interrupt_bind(0x0, r2, 0xffff, 0x1) syz_execute_func(&(0x7f0000000000)="c4a1f970cedbc46345689e9f5200000026f30f5e051b000000f23ef26465f30f01daf9c441ca511a660f3800bd86aab254c48145e1e53644f6468d64f3ab") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffa000/0x3000)=nil, 0x3000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_port_create))(/*options=*/0, /*out=*/0x20000000); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000000; break; case 1: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_port_cancel))(/*port=*/r[0], /*source=*/0, /*key=*/0x3f2); break; case 2: ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); } } break; case 3: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_property))(/*handle=*/r[0], /*property=*/0x10, /*value=*/0x20000080, /*size=*/4); break; case 4: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/8, /*buffer=*/0x200000c0, /*buffer_size=*/0x48, /*actual=*/0x20000140, /*avail=*/0x20000180); break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_get_event))(/*root_job=*/0, /*kind=*/3, /*event=*/0x200001c0); if (res == ZX_OK) r[1] = *(uint32_t*)0x200001c0; break; case 6: *(uint64_t*)0x200102c0 = 0x20000200; *(uint32_t*)0x20000200 = 0; memset((void*)0x20000204, 0, 3); *(uint8_t*)0x20000207 = 1; *(uint64_t*)0x20000208 = 0x3217bced00000000; *(uint64_t*)0x200102c8 = 0x20000240; *(uint64_t*)0x200102d0 = 0x20000280; *(uint64_t*)0x200102d8 = 0x20010280; *(uint32_t*)0x200102e0 = 0x10; *(uint32_t*)0x200102e4 = 0; *(uint32_t*)0x200102e8 = 0x10000; *(uint32_t*)0x200102ec = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0, /*args=*/0x200102c0, /*actual_bytes=*/0x20010300, /*actual_handles=*/0x20010340); break; case 7: memcpy((void*)0x20010380, "\xd7\x07\x49\x30\xee\x6f\x10\x43\x8b\xae\xc2\x44\x6f\xa0\x8a\x80\x9f\xa9\x77\x72\xcd\xf3\xa5\x66\x6a\x5b\x8d\xe3\xf1\xe3\x20\xe9\xb7\xc3\x00\x82\x27\x21\x4c\x82\x05\xfb\x93\x27\xdd\xc5\x9a\x5c\x1c\x3c\xff\xe2\x67\x6d\xfa\x6d\xeb\x4d\x32\xc5\xa8\x26\x01\xa0\x3f\x5e\x8f\x8e\x19\x65\x0a\x41\xf8\xc3\xa6\x60\x46\x8a\xd9\x88\x90\xd6\x4e\x49\x17\xb7\xa3\x34\x29\x72\x83\x2c\x9f\x9b\xc6\xc7\x61\x48\x5e\x2d\x23\x11\x9c\x50\x76\x83\xb6\x06\xca\xe5\x43\x97\xbd\x8e\x70\x8d\x00\x1c\x52\x9c\xc4\x6f\xcf\x8a\xa3\x0d\x69\x71\xc8\xc0\x70\xf8\xa9\x3a\x91\xaa\x42\x07\x80\xa4\xd9\x8a\xe6\xfd\xd8\x0b\x13\x72\x8e\x57\xba\x4e\xa4\xa6\xd6\x3b\x48\x17\x3d\xc7\x31\xea\x66\xb1\x20\x45\x4b\xb2\xf9\x1b\x17\x63\xb5\x5f\xff\xf2\xce\x1a\x0e\x28\xc3\xc9\xec\x31\x33\xf5\xba\x39\xaf\x85\xff\xb2\x30\xbd\x57\xa3\xe4\x47\xa7\xb7\x96\x61\xc5\xbc\x4d\xd5\xc9\x8a\xb4\xa6\xd7\x07\x0e\x11\xa8\x1a\x46\xe9\x39\x28\xd5\xbd\x58\xcc\x05\x87\x3b\x8f\xfb\xb2\x79\xda\xab\x61\xde\x21\x2d\x4b\xa5\xfc\x08\x33\x17\xe3\x2e\xea\x47\x1c\x4f\x27\xfd", 251); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_fifo_write))(/*handle=*/r[1], /*elem_size=*/0xffffffffffffff46, /*data=*/0x20010380, /*count=*/0xfb, /*actual_count=*/0x20010480); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[0], /*topic=*/0x1b, /*buffer=*/0x200104c0, /*buffer_size=*/0x28, /*actual=*/0x20010500, /*avail=*/0x20010540); if (res == ZX_OK) r[2] = *(uint32_t*)0x200104c4; break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_interrupt_bind))(/*handle=*/0, /*port_handle=*/r[2], /*key=*/0xffff, /*options=*/1); break; case 10: memcpy((void*)0x20000000, "\xc4\xa1\xf9\x70\xce\xdb\xc4\x63\x45\x68\x9e\x9f\x52\x00\x00\x00\x26\xf3\x0f\x5e\x05\x1b\x00\x00\x00\xf2\x3e\xf2\x64\x65\xf3\x0f\x01\xda\xf9\xc4\x41\xca\x51\x1a\x66\x0f\x38\x00\xbd\x86\xaa\xb2\x54\xc4\x81\x45\xe1\xe5\x36\x44\xf6\x46\x8d\x64\xf3\xab", 62); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffa000, /*len=*/0x3000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :276:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ :280:39: error: use of undeclared identifier 'zx_vcpu_enter' ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_vcpu_enter))(/*handle=*/r[0], /*packet=*/0x20000040); ^ 2 errors generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2010816127 -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 (2.58s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/3 (2.59s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/7 (2.64s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/4 (2.64s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 25.789s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ok github.com/google/syzkaller/pkg/email/lore (cached) ok github.com/google/syzkaller/pkg/host 31.214s ok github.com/google/syzkaller/pkg/html (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image 2.238s ok github.com/google/syzkaller/pkg/instance 3.357s ok github.com/google/syzkaller/pkg/ipc 24.895s ok github.com/google/syzkaller/pkg/kconfig (cached) ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 2.824s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 14.445s ok github.com/google/syzkaller/pkg/repro 2.877s ok github.com/google/syzkaller/pkg/runtest 82.180s ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem (cached) ok github.com/google/syzkaller/pkg/subsystem/linux (cached) ok github.com/google/syzkaller/pkg/subsystem/lists (cached) ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ok github.com/google/syzkaller/prog 17.257s ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux 0.114s ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci 4.772s ok github.com/google/syzkaller/syz-fuzzer 0.464s ok github.com/google/syzkaller/syz-hub 0.103s ok github.com/google/syzkaller/syz-hub/state 1.911s ok github.com/google/syzkaller/syz-manager 4.952s ok github.com/google/syzkaller/syz-verifier 4.996s ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/parser 0.152s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 0.298s ok github.com/google/syzkaller/vm 12.335s ok github.com/google/syzkaller/vm/isolated 4.415s ok github.com/google/syzkaller/vm/proxyapp 6.796s ok github.com/google/syzkaller/vm/vmimpl 4.988s FAIL