? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app 0.106s ? 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/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/ifuzz/powerpc/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 5.020s ok github.com/google/syzkaller/pkg/asset 0.137s ok github.com/google/syzkaller/pkg/ast 0.654s ok github.com/google/syzkaller/pkg/auth (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/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 73.579s ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build 8.681s ok github.com/google/syzkaller/pkg/compiler 6.095s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover 13.715s ok github.com/google/syzkaller/pkg/cover/backend 0.462s --- FAIL: TestGenerate (10.34s) --- FAIL: TestGenerate/fuchsia/amd64 (0.23s) testutil.go:33: seed=1694427317043070857 testutil.go:33: seed=1694427317276859112 --- FAIL: TestGenerate/fuchsia/amd64/5 (1.63s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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) { 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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 < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :269:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2855461698 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/10 (1.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:false HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :255:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor339118594 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/14 (1.60s) 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_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :271:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3423098842 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/6 (1.79s) 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_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :267:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor989830794 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/4 (1.80s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:1 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :267:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2679085714 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/8 (1.82s) 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_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :267:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1559630819 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/7 (1.85s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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; } #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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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(); loop(); return 0; } :261:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor184807798 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/1 (1.89s) 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_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :267:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3527728318 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/3 (1.91s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:10 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :267:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor4274502712 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/9 (1.92s) 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_socket_set_disposition(0x0, 0x1, 0x2) (fail_nth: 1) zx_channel_call$fuchsia_io_NodeSetAttr(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010100)={&(0x7f0000000000)={{}, 0x48, {0x8, 0xffff, 0xcab4, 0x7, 0x1ff, 0x10000, 0x80000001}}, &(0x7f0000000080), &(0x7f00000000c0), &(0x7f00000100c0), 0x48, 0x0, 0x10000}, &(0x7f0000010140), &(0x7f0000010180)) (async) r0 = syz_future_time(0x0) (rerun: 4) zx_channel_call$fuchsia_cobalt_MetricEventLoggerLogString(0x0, 0x0, r0, &(0x7f00000202c0)={&(0x7f00000101c0)={{}, 0xffff, {0x601}, {0x7, 0xffffffffffffffff}, {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}, [0x7c, 0xffff0001, 0x0, 0x5c]}, &(0x7f0000010240), &(0x7f0000010280), &(0x7f0000020280), 0x5c, 0x0, 0x10000}, &(0x7f0000020300), &(0x7f0000020340)) zx_handle_replace(0x0, 0x8, &(0x7f0000020380)=0x0) zx_channel_call$fuchsia_io_FileGetFlags(r1, 0x0, r0, &(0x7f0000030480)={&(0x7f00000203c0), &(0x7f0000020400), &(0x7f0000020440), &(0x7f0000030440), 0x10, 0x0, 0x10000}, &(0x7f00000304c0), &(0x7f0000030500)) zx_task_create_exception_channel(r1, 0x1, &(0x7f0000030540)=0x0) zx_channel_call$fuchsia_hardware_ethernet_DeviceSetPromiscuousMode(r2, 0x0, r0, &(0x7f0000040640)={&(0x7f0000030580)={{}, 0x2d}, &(0x7f00000305c0), &(0x7f0000030600), &(0x7f0000040600), 0x11, 0x0, 0x10000}, &(0x7f0000040680), &(0x7f00000406c0)) zx_vcpu_create(r2, 0x8, 0x10001, &(0x7f0000040700)=0x0) zx_channel_call$fuchsia_cobalt_LoggerLogCobaltEvents(r3, 0x0, r0, &(0x7f0000050a40)={&(0x7f0000040740)={{}, {0x1c11aff3, 0xffffffffffffffff}, {[{0x0, {0xfffffffffffffff7, 0xffffffffffffffff}, {0xfff, 0xffffffffffffffff}, @eventInLine={0x1, {0x5d}}}, {0xffff0000, {0x8000, 0xffffffffffffffff}, {0x9, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x400}}}, {0x4, {0x3, 0xffffffffffffffff}, {0x1, 0xffffffffffffffff}, @int_histogramInLine={0x7, {0x8, 0xffffffffffffffff}}}, {0x1ff, {0x7fffffffffffffff, 0xffffffffffffffff}, {0x1f, 0xffffffffffffffff}, @fps={0x4, 0x24}}, {0x0, {0x1, 0xffffffffffffffff}, {0xffff}, @fps={0x4, 0x3}}, {0x1, {0x101}, {0x8, 0xffffffffffffffff}, @memory_bytes_used={0x5, 0x9a2a}}], [{[0x7f, 0x0, 0x9], {'\x00'}}, {[0x5]}, {[0x8001, 0x8, 0x1, 0x400, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0x5, 0xdd], {'7'}}, {[0x20, 0xffffff37, 0x6dd], {'-/-*(!//]'}}, {[0xfffffff8, 0x1, 0x3, 0xff, 0x79a9, 0x9, 0x1], {'^\xae-'}}, {[0x800, 0x7], {'-%*$\\\'*[*\'\xf1(.#}[]+\x9b:\\-'}}, {[0xfffffe14, 0x1, 0x6, 0x8001, 0x64773f73, 0x2, 0x6]}, {[0xcd, 0x1f, 0xaec7, 0x2], {'['}}]}}, &(0x7f00000409c0)={[{}, {}, {}, {}]}, &(0x7f0000040a00), &(0x7f0000050a00), 0x270, 0x0, 0x10000}, &(0x7f0000050a80), &(0x7f0000050ac0)) syz_execute_func(&(0x7f0000000000)="c4a35d784e008a66440f7fb7f4fffffff0ff4991c4a17963b06b000000c482792261648f892001ddc4a1d1ef0dd692ab036543f630c4a109de7455f940d8c0") 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[4] = {0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); break; case 1: *(uint64_t*)0x20010100 = 0x20000000; *(uint32_t*)0x20000000 = 0; memset((void*)0x20000004, 0, 3); *(uint8_t*)0x20000007 = 1; *(uint64_t*)0x20000008 = 0xbd5559a00000000; *(uint32_t*)0x20000010 = 0x48; *(uint32_t*)0x20000014 = 8; *(uint64_t*)0x20000018 = 0xffff; *(uint64_t*)0x20000020 = 0xcab4; *(uint64_t*)0x20000028 = 7; *(uint64_t*)0x20000030 = 0x1ff; *(uint64_t*)0x20000038 = 0x10000; *(uint64_t*)0x20000040 = 0x80000001; *(uint64_t*)0x20010108 = 0x20000080; *(uint64_t*)0x20010110 = 0x200000c0; *(uint64_t*)0x20010118 = 0x200100c0; *(uint32_t*)0x20010120 = 0x48; *(uint32_t*)0x20010124 = 0; *(uint32_t*)0x20010128 = 0x10000; *(uint32_t*)0x2001012c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010100, /*actual_bytes=*/0x20010140, /*actual_handles=*/0x20010180); break; case 2: res = -1; res = syz_future_time(/*when=*/0); { int i; for(i = 0; i < 4; i++) { syz_future_time(/*when=*/0); } } if ((int)res != -1) r[0] = res; break; case 3: *(uint64_t*)0x200202c0 = 0x200101c0; *(uint32_t*)0x200101c0 = 0; memset((void*)0x200101c4, 0, 3); *(uint8_t*)0x200101c7 = 1; *(uint64_t*)0x200101c8 = 0x591cb25600000000; *(uint32_t*)0x200101d0 = 0xffff; *(uint64_t*)0x200101d4 = 0x601; *(uint64_t*)0x200101dc = 0; *(uint64_t*)0x200101e4 = 7; *(uint64_t*)0x200101ec = -1; memcpy((void*)0x200101f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2001020c = 0x7c; *(uint32_t*)0x20010210 = 0xffff0001; *(uint32_t*)0x20010214 = 0; *(uint32_t*)0x20010218 = 0x5c; *(uint64_t*)0x200202c8 = 0x20010240; *(uint64_t*)0x200202d0 = 0x20010280; *(uint64_t*)0x200202d8 = 0x20020280; *(uint32_t*)0x200202e0 = 0x5c; *(uint32_t*)0x200202e4 = 0; *(uint32_t*)0x200202e8 = 0x10000; *(uint32_t*)0x200202ec = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/r[0], /*args=*/0x200202c0, /*actual_bytes=*/0x20020300, /*actual_handles=*/0x20020340); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_handle_replace))(/*handle=*/0, /*rights=*/8, /*out=*/0x20020380); if (res == ZX_OK) r[1] = *(uint32_t*)0x20020380; break; case 5: *(uint64_t*)0x20030480 = 0x200203c0; *(uint32_t*)0x200203c0 = 0; memset((void*)0x200203c4, 0, 3); *(uint8_t*)0x200203c7 = 1; *(uint64_t*)0x200203c8 = 0x6416a3f600000000; *(uint64_t*)0x20030488 = 0x20020400; *(uint64_t*)0x20030490 = 0x20020440; *(uint64_t*)0x20030498 = 0x20030440; *(uint32_t*)0x200304a0 = 0x10; *(uint32_t*)0x200304a4 = 0; *(uint32_t*)0x200304a8 = 0x10000; *(uint32_t*)0x200304ac = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20030480, /*actual_bytes=*/0x200304c0, /*actual_handles=*/0x20030500); break; case 6: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/1, /*out=*/0x20030540); if (res == ZX_OK) r[2] = *(uint32_t*)0x20030540; break; case 7: *(uint64_t*)0x20040640 = 0x20030580; *(uint32_t*)0x20030580 = 0; memset((void*)0x20030584, 0, 3); *(uint8_t*)0x20030587 = 1; *(uint64_t*)0x20030588 = 0x34c1970400000000; *(uint8_t*)0x20030590 = 0x2d; *(uint64_t*)0x20040648 = 0x200305c0; *(uint64_t*)0x20040650 = 0x20030600; *(uint64_t*)0x20040658 = 0x20040600; *(uint32_t*)0x20040660 = 0x11; *(uint32_t*)0x20040664 = 0; *(uint32_t*)0x20040668 = 0x10000; *(uint32_t*)0x2004066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[2], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20040640, /*actual_bytes=*/0x20040680, /*actual_handles=*/0x200406c0); break; case 8: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_create))(/*guest=*/r[2], /*options=*/8, /*entry=*/0x10001, /*out=*/0x20040700); if (res == ZX_OK) r[3] = *(uint32_t*)0x20040700; break; case 9: *(uint64_t*)0x20050a40 = 0x20040740; *(uint32_t*)0x20040740 = 0; memset((void*)0x20040744, 0, 3); *(uint8_t*)0x20040747 = 1; *(uint64_t*)0x20040748 = 0x2905d69400000000; *(uint64_t*)0x20040750 = 0x1c11aff3; *(uint64_t*)0x20040758 = -1; *(uint32_t*)0x20040760 = 0; *(uint64_t*)0x20040764 = 0xfffffffffffffff7; *(uint64_t*)0x2004076c = -1; *(uint64_t*)0x20040774 = 0xfff; *(uint64_t*)0x2004077c = -1; *(uint32_t*)0x20040784 = 1; *(uint8_t*)0x20040788 = 0x5d; *(uint32_t*)0x2004079c = 0xffff0000; *(uint64_t*)0x200407a0 = 0x8000; *(uint64_t*)0x200407a8 = -1; *(uint64_t*)0x200407b0 = 9; *(uint64_t*)0x200407b8 = -1; *(uint32_t*)0x200407c0 = 7; *(uint64_t*)0x200407c8 = 0x400; *(uint64_t*)0x200407d0 = 0; *(uint32_t*)0x200407d8 = 4; *(uint64_t*)0x200407dc = 3; *(uint64_t*)0x200407e4 = -1; *(uint64_t*)0x200407ec = 1; *(uint64_t*)0x200407f4 = -1; *(uint32_t*)0x200407fc = 7; *(uint64_t*)0x20040804 = 8; *(uint64_t*)0x2004080c = -1; *(uint32_t*)0x20040814 = 0x1ff; *(uint64_t*)0x20040818 = 0x7fffffffffffffff; *(uint64_t*)0x20040820 = -1; *(uint64_t*)0x20040828 = 0x1f; *(uint64_t*)0x20040830 = -1; *(uint32_t*)0x20040838 = 4; *(uint32_t*)0x2004083c = 0x24; *(uint32_t*)0x20040850 = 0; *(uint64_t*)0x20040854 = 1; *(uint64_t*)0x2004085c = -1; *(uint64_t*)0x20040864 = 0xffff; *(uint64_t*)0x2004086c = 0; *(uint32_t*)0x20040874 = 4; *(uint32_t*)0x20040878 = 3; *(uint32_t*)0x2004088c = 1; *(uint64_t*)0x20040890 = 0x101; *(uint64_t*)0x20040898 = 0; *(uint64_t*)0x200408a0 = 8; *(uint64_t*)0x200408a8 = -1; *(uint32_t*)0x200408b0 = 5; *(uint64_t*)0x200408b8 = 0x9a2a; *(uint32_t*)0x200408c8 = 0x7f; *(uint32_t*)0x200408cc = 0; *(uint32_t*)0x200408d0 = 9; memset((void*)0x200408d4, 0, 1); *(uint32_t*)0x200408dc = 5; *(uint32_t*)0x200408e0 = 0x8001; *(uint32_t*)0x200408e4 = 8; *(uint32_t*)0x200408e8 = 1; *(uint32_t*)0x200408ec = 0x400; *(uint32_t*)0x200408f0 = 7; memcpy((void*)0x200408f4, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004090c = 5; *(uint32_t*)0x20040910 = 0xdd; memset((void*)0x20040914, 55, 1); *(uint32_t*)0x2004091c = 0x20; *(uint32_t*)0x20040920 = 0xffffff37; *(uint32_t*)0x20040924 = 0x6dd; memcpy((void*)0x20040928, "-/-*(!//]", 9); *(uint32_t*)0x20040938 = 0xfffffff8; *(uint32_t*)0x2004093c = 1; *(uint32_t*)0x20040940 = 3; *(uint32_t*)0x20040944 = 0xff; *(uint32_t*)0x20040948 = 0x79a9; *(uint32_t*)0x2004094c = 9; *(uint32_t*)0x20040950 = 1; memcpy((void*)0x20040954, "^\256-", 3); *(uint32_t*)0x2004095c = 0x800; *(uint32_t*)0x20040960 = 7; memcpy((void*)0x20040964, "-%*$\\\'*[*\'\361(.#}[]+\233:\\-", 22); *(uint32_t*)0x2004097c = 0xfffffe14; *(uint32_t*)0x20040980 = 1; *(uint32_t*)0x20040984 = 6; *(uint32_t*)0x20040988 = 0x8001; *(uint32_t*)0x2004098c = 0x64773f73; *(uint32_t*)0x20040990 = 2; *(uint32_t*)0x20040994 = 6; *(uint32_t*)0x20040998 = 0xcd; *(uint32_t*)0x2004099c = 0x1f; *(uint32_t*)0x200409a0 = 0xaec7; *(uint32_t*)0x200409a4 = 2; memset((void*)0x200409a8, 91, 1); *(uint64_t*)0x20050a48 = 0x200409c0; *(uint64_t*)0x20050a50 = 0x20040a00; *(uint64_t*)0x20050a58 = 0x20050a00; *(uint32_t*)0x20050a60 = 0x270; *(uint32_t*)0x20050a64 = 0; *(uint32_t*)0x20050a68 = 0x10000; *(uint32_t*)0x20050a6c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[3], /*options=*/0, /*deadline=*/r[0], /*args=*/0x20050a40, /*actual_bytes=*/0x20050a80, /*actual_handles=*/0x20050ac0); break; case 10: memcpy((void*)0x20000000, "\xc4\xa3\x5d\x78\x4e\x00\x8a\x66\x44\x0f\x7f\xb7\xf4\xff\xff\xff\xf0\xff\x49\x91\xc4\xa1\x79\x63\xb0\x6b\x00\x00\x00\xc4\x82\x79\x22\x61\x64\x8f\x89\x20\x01\xdd\xc4\xa1\xd1\xef\x0d\xd6\x92\xab\x03\x65\x43\xf6\x30\xc4\xa1\x09\xde\x74\x55\xf9\x40\xd8\xc0", 63); 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; } :267:48: error: use of undeclared identifier 'zx_socket_set_disposition' ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_socket_set_disposition))(/*handle=*/0, /*disposition=*/1, /*disposition_peer=*/2); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3271636107 -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.95s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/2 (1.98s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/13 (1.97s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/12 (2.11s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 17.734s 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 26.850s ok github.com/google/syzkaller/pkg/html (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image 2.081s ok github.com/google/syzkaller/pkg/instance 6.156s ok github.com/google/syzkaller/pkg/ipc 14.370s 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 5.251s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 10.645s ok github.com/google/syzkaller/pkg/repro 5.026s ok github.com/google/syzkaller/pkg/runtest 70.589s 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 0.253s 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 44.862s ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux 0.164s ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci 6.749s ok github.com/google/syzkaller/syz-fuzzer 0.525s ok github.com/google/syzkaller/syz-hub 0.164s ok github.com/google/syzkaller/syz-hub/state 2.291s ok github.com/google/syzkaller/syz-manager 7.110s ok github.com/google/syzkaller/syz-verifier 6.493s 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.166s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 0.312s ok github.com/google/syzkaller/vm 14.739s ok github.com/google/syzkaller/vm/isolated 6.479s ok github.com/google/syzkaller/vm/proxyapp 8.864s ok github.com/google/syzkaller/vm/vmimpl 6.469s FAIL