? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ? github.com/google/syzkaller/pkg/html [no test files] ? github.com/google/syzkaller/pkg/html/pages [no test files] ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/signal [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin [no test files] ? github.com/google/syzkaller/sys/darwin/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd [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-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] ok github.com/google/syzkaller/executor 2.281s ok github.com/google/syzkaller/pkg/asset (cached) ok github.com/google/syzkaller/pkg/ast 0.842s ok github.com/google/syzkaller/pkg/auth (cached) ok github.com/google/syzkaller/pkg/bisect (cached) ok github.com/google/syzkaller/pkg/build (cached) ? 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/compiler 2.883s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover (cached) ok github.com/google/syzkaller/pkg/cover/backend (cached) --- FAIL: TestGenerate (19.23s) --- FAIL: TestGenerate/fuchsia/amd64 (0.04s) testutil.go:33: seed=1677394150969947802 --- FAIL: TestGenerate/fuchsia/amd64/7 (0.32s) csource_test.go:133: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); loop(); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2506655466 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/12 (0.32s) csource_test.go:133: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor4024357138 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/0 (0.32s) csource_test.go:133: opts: {Threaded:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_one(void) { intptr_t res = 0; inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); syz_future_time(0); syz_job_default(); syz_mmap(0x20ffd000, 0x2000); syz_process_self(); syz_thread_self(); syz_vmar_root_self(); } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :7:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3862263123 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/14 (0.14s) csource_test.go:133: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:2 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor467016753 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/4 (0.14s) csource_test.go:133: 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 UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3044981869 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/13 (0.15s) csource_test.go:133: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:true LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); fprintf(stderr, "### call=0 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); fprintf(stderr, "### call=1 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); fprintf(stderr, "### call=2 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); fprintf(stderr, "### call=3 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 4: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); fprintf(stderr, "### call=4 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); fprintf(stderr, "### call=5 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; errno = EFAULT; res = ((intptr_t(*)())CAST(get_root_resource))(); fprintf(stderr, "### call=6 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if ((int)res != -1) r[4] = res; break; case 7: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); fprintf(stderr, "### call=7 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); fprintf(stderr, "### call=8 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 9: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); fprintf(stderr, "### call=9 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); res = -1; errno = EFAULT; res = syz_execute_func(0x20000000); fprintf(stderr, "### call=10 errno=%u\n", res == -1 ? errno : 0); break; case 11: res = -1; errno = EFAULT; res = syz_future_time(0); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; case 12: res = -1; errno = EFAULT; res = syz_job_default(); fprintf(stderr, "### call=12 errno=%u\n", res == -1 ? errno : 0); break; case 13: res = -1; errno = EFAULT; res = syz_mmap(0x20ffd000, 0x2000); fprintf(stderr, "### call=13 errno=%u\n", res == -1 ? errno : 0); break; case 14: res = -1; errno = EFAULT; res = syz_process_self(); fprintf(stderr, "### call=14 errno=%u\n", res == -1 ? errno : 0); break; case 15: res = -1; errno = EFAULT; res = syz_thread_self(); fprintf(stderr, "### call=15 errno=%u\n", res == -1 ? errno : 0); break; case 16: res = -1; errno = EFAULT; res = syz_vmar_root_self(); fprintf(stderr, "### call=16 errno=%u\n", res == -1 ? errno : 0); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2442643194 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/6 (0.16s) csource_test.go:133: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:10 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 500); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2995423631 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/5 (0.23s) csource_test.go:133: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #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[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2208787288 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/3 (0.23s) csource_test.go:133: opts: {Threaded:true Repeat:true RepeatTimes:10 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2516150918 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/2 (0.24s) csource_test.go:133: opts: {Threaded:true Repeat:false RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_stream_seek(0x0, 0x1, 0x8, &(0x7f0000000000)=0x0) (fail_nth: 1) zx_stream_readv_at(0x0, 0x0, r0, &(0x7f0000000140)=[{&(0x7f0000000040)="1dbbb25cf45e520025f9c3a033b31b3a7969f7b384ed40aed6fba77a34ac1a64d1c95f9f7230446ed1ac8ecfdb9d39ca441ead1b96b12a6fd18da42173794436402ff5b4063215ecc612fd27da75c703b9b4f6944304041476d52c130b37f7f9c0067864ce18e33f6119b30fc4e4d2b040131db7201bc5e6af7c3467b67a129df678bfb11aba6ab56fa7fddd654e325f2a80386b8754b9f2eeed19abaa249428a367bf8bf788d2c66657a67c50394fa4e76ce217b12b0722001eee20736a11156183494fae831c2edf250858bf234c4269b07d001373dc3e0df227ec3a554651f758992975d9d1238c", 0xe9}], 0x1, &(0x7f0000000180)) (async) zx_channel_call$fuchsia_io_DirectoryDescribe(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000010280)={&(0x7f00000001c0), &(0x7f0000000200), &(0x7f0000000240), &(0x7f0000010240)={@tty={0x0}}, 0x10, 0x0, 0x10000, 0x1}, &(0x7f00000102c0), &(0x7f0000010300)) (rerun: 4) zx_stream_readv(r1, 0x0, &(0x7f00000107c0)=[{&(0x7f0000010340)="13ccbcace9bec9588ef417b72f309eabab8261a79e651e4c24", 0x19}, {&(0x7f0000010380)="34740cb62b97", 0x6}, {&(0x7f00000103c0)="168ac07f7e3b669b1ca5880a2e28dc095b3fe131ad1eb10728758dbd2f595d928ca66208e7d7b692ef2c841eefd28125bbf4d62d30c96806e729cb70e833f10cab51e6e5216509944bfdf0375ba3ffd45ed44d6f702b4d571af99d1130181cffcbb1db5bbbf0e31577d115f71ff167ae0eb9f13f64f67757293146986813812748b96a1c118f4048f4aa6e52245d87f5779e47b5b59a536b6e5fcaf43f586869a57952b92ba1eb14c14f31e7c8587ce277592a4bc12f6d1ea82acdc9b973dbe1460196899a00297e4e7132e3b00828", 0xcf}, {&(0x7f00000104c0)="db71d76cc7ccc94acb73768cdf08cadc1361e1", 0x13}, {&(0x7f0000010500)="eeb2850724606ae7ce7a5652b5b8a8f3a5c06132979557f4854614e666041c1a9414826002449785039a57863aad0d64f99b27b81bdf9150f2792c6230ccdafef21193496f8b4ebbe48dcc5ccb880a69ad2aa6ed15a3576e656acbd1d5abfe14214bfb95cf87a6215019229374f041a6ce16420fe4763ab1fecea5db14919ec69c503acc07e51e4e15b777ed58e3cb58dd7a8ac9eeb4356cb3232fc66c7701ae4e23f14d11cce19a0b881b84d02053251ba5ea826fdb7da2ba5d4ec4ea1c51ce7e0c5642b3", 0xc5}, {&(0x7f0000010600)="d35ae8f9b709073a472079b12033dfd09c6a4718646cd992b2d1cd3589446b63b30c67", 0x23}, {&(0x7f0000010640)="5063cdf3589ec6c7b9540e7514f95ff7df32dedfab4e", 0x16}, {&(0x7f0000010680)="6225f8bb38693aa65411301b35842574ddc40d87497aa2f3fe39f7b8baccc10a30c6a9d2ad6516d88365662655aebdb47320763ac28ef733b202bd", 0x3b}, {&(0x7f00000106c0)="f6cf9eeec4e1068663cd86fc0c255f051c750c853d1cc07483b73b0759d5284ebd41bc8db28eb7b5dbdf7221d87793262d57bcab1199a0ceda8b5e4c57217038c17f96f0dfff52fac698c73c2a0d69266477abf578c05fc50e75ba8461997a9c6fd9f06189516090d47ee8d81a93da8002d88cecf26d3cead9b59f230bdc46266fb0dc7608cdbef037746bc71c1d865acff03fd5afb6a4ea9a1e7f0b5c1899a287e2ee8a8da9ac0edcc302c3f96a36480b6cb31d1e29787d715f450d3c467dfc4dbd31f3562ac994b2634e91a8d3eaa7252fe0db77b2e6da554e67a34317e38e0007ec37ee584978e7c09b2806c171", 0xef}], 0x9, &(0x7f0000010880)) zx_event_create(0xffe00, &(0x7f00000108c0)=0x0) zx_channel_create$fuchsia_cobalt_SystemDataUpdater(0x0, &(0x7f0000010940), &(0x7f0000010980)=0x0) r4 = get_root_resource() zx_vmar_allocate(r1, 0x16000000, 0xd7d1, 0xffffffffffffffff, &(0x7f00000109c0)=0x0, &(0x7f0000010a00)) zx_channel_write$fuchsia_process_LauncherAddHandles(r2, 0x0, &(0x7f0000010900)={{}, {0xfff}, {[{0xffffffff, 0x9}], [{}, {}]}}, 0x28, &(0x7f0000010a40)={[{r3}, {r4}, {r5}, {r1}, {r1}, {r1}]}, 0x18) zx_vcpu_write_state(r4, 0x80000001, &(0x7f0000010a80)=""/245, 0xf5) syz_execute_func(&(0x7f0000000000)="c42201041db23bae8b672e2641c704fb27270000f0410fc78b95424ed765a20a00000000000000c483c95e1805c4e2b190347bf20f59333e0f38f15bd23ef3470f2a98c1596e05c461aa11c1") syz_future_time(0x0) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:134: 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 #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void loop(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } uint64_t r[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_seek))(0, 1, 8, 0x20000000); if (res == ZX_OK) r[0] = *(uint64_t*)0x20000000; break; case 1: *(uint64_t*)0x20000140 = 0x20000040; memcpy((void*)0x20000040, "\x1d\xbb\xb2\x5c\xf4\x5e\x52\x00\x25\xf9\xc3\xa0\x33\xb3\x1b\x3a\x79\x69\xf7\xb3\x84\xed\x40\xae\xd6\xfb\xa7\x7a\x34\xac\x1a\x64\xd1\xc9\x5f\x9f\x72\x30\x44\x6e\xd1\xac\x8e\xcf\xdb\x9d\x39\xca\x44\x1e\xad\x1b\x96\xb1\x2a\x6f\xd1\x8d\xa4\x21\x73\x79\x44\x36\x40\x2f\xf5\xb4\x06\x32\x15\xec\xc6\x12\xfd\x27\xda\x75\xc7\x03\xb9\xb4\xf6\x94\x43\x04\x04\x14\x76\xd5\x2c\x13\x0b\x37\xf7\xf9\xc0\x06\x78\x64\xce\x18\xe3\x3f\x61\x19\xb3\x0f\xc4\xe4\xd2\xb0\x40\x13\x1d\xb7\x20\x1b\xc5\xe6\xaf\x7c\x34\x67\xb6\x7a\x12\x9d\xf6\x78\xbf\xb1\x1a\xba\x6a\xb5\x6f\xa7\xfd\xdd\x65\x4e\x32\x5f\x2a\x80\x38\x6b\x87\x54\xb9\xf2\xee\xed\x19\xab\xaa\x24\x94\x28\xa3\x67\xbf\x8b\xf7\x88\xd2\xc6\x66\x57\xa6\x7c\x50\x39\x4f\xa4\xe7\x6c\xe2\x17\xb1\x2b\x07\x22\x00\x1e\xee\x20\x73\x6a\x11\x15\x61\x83\x49\x4f\xae\x83\x1c\x2e\xdf\x25\x08\x58\xbf\x23\x4c\x42\x69\xb0\x7d\x00\x13\x73\xdc\x3e\x0d\xf2\x27\xec\x3a\x55\x46\x51\xf7\x58\x99\x29\x75\xd9\xd1\x23\x8c", 233); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv_at))(0, 0, r[0], 0x20000140, 1, 0x20000180); break; case 2: *(uint64_t*)0x20010280 = 0x200001c0; *(uint32_t*)0x200001c0 = 0; memset((void*)0x200001c4, 0, 3); *(uint8_t*)0x200001c7 = 1; *(uint64_t*)0x200001c8 = 0x1f62df5e00000000; *(uint64_t*)0x20010288 = 0x20000200; *(uint64_t*)0x20010290 = 0x20000240; *(uint64_t*)0x20010298 = 0x20010240; *(uint32_t*)0x200102a0 = 0x10; *(uint32_t*)0x200102a4 = 0; *(uint32_t*)0x200102a8 = 0x10000; *(uint32_t*)0x200102ac = 1; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(0, 0, 0x7fffffffffffffff, 0x20010280, 0x200102c0, 0x20010300); } } if (res == ZX_OK) r[1] = *(uint32_t*)0x20010240; break; case 3: *(uint64_t*)0x200107c0 = 0x20010340; memcpy((void*)0x20010340, "\x13\xcc\xbc\xac\xe9\xbe\xc9\x58\x8e\xf4\x17\xb7\x2f\x30\x9e\xab\xab\x82\x61\xa7\x9e\x65\x1e\x4c\x24", 25); *(uint64_t*)0x200107d0 = 0x20010380; memcpy((void*)0x20010380, "\x34\x74\x0c\xb6\x2b\x97", 6); *(uint64_t*)0x200107e0 = 0x200103c0; memcpy((void*)0x200103c0, "\x16\x8a\xc0\x7f\x7e\x3b\x66\x9b\x1c\xa5\x88\x0a\x2e\x28\xdc\x09\x5b\x3f\xe1\x31\xad\x1e\xb1\x07\x28\x75\x8d\xbd\x2f\x59\x5d\x92\x8c\xa6\x62\x08\xe7\xd7\xb6\x92\xef\x2c\x84\x1e\xef\xd2\x81\x25\xbb\xf4\xd6\x2d\x30\xc9\x68\x06\xe7\x29\xcb\x70\xe8\x33\xf1\x0c\xab\x51\xe6\xe5\x21\x65\x09\x94\x4b\xfd\xf0\x37\x5b\xa3\xff\xd4\x5e\xd4\x4d\x6f\x70\x2b\x4d\x57\x1a\xf9\x9d\x11\x30\x18\x1c\xff\xcb\xb1\xdb\x5b\xbb\xf0\xe3\x15\x77\xd1\x15\xf7\x1f\xf1\x67\xae\x0e\xb9\xf1\x3f\x64\xf6\x77\x57\x29\x31\x46\x98\x68\x13\x81\x27\x48\xb9\x6a\x1c\x11\x8f\x40\x48\xf4\xaa\x6e\x52\x24\x5d\x87\xf5\x77\x9e\x47\xb5\xb5\x9a\x53\x6b\x6e\x5f\xca\xf4\x3f\x58\x68\x69\xa5\x79\x52\xb9\x2b\xa1\xeb\x14\xc1\x4f\x31\xe7\xc8\x58\x7c\xe2\x77\x59\x2a\x4b\xc1\x2f\x6d\x1e\xa8\x2a\xcd\xc9\xb9\x73\xdb\xe1\x46\x01\x96\x89\x9a\x00\x29\x7e\x4e\x71\x32\xe3\xb0\x08\x28", 207); *(uint64_t*)0x200107f0 = 0x200104c0; memcpy((void*)0x200104c0, "\xdb\x71\xd7\x6c\xc7\xcc\xc9\x4a\xcb\x73\x76\x8c\xdf\x08\xca\xdc\x13\x61\xe1", 19); *(uint64_t*)0x20010800 = 0x20010500; memcpy((void*)0x20010500, "\xee\xb2\x85\x07\x24\x60\x6a\xe7\xce\x7a\x56\x52\xb5\xb8\xa8\xf3\xa5\xc0\x61\x32\x97\x95\x57\xf4\x85\x46\x14\xe6\x66\x04\x1c\x1a\x94\x14\x82\x60\x02\x44\x97\x85\x03\x9a\x57\x86\x3a\xad\x0d\x64\xf9\x9b\x27\xb8\x1b\xdf\x91\x50\xf2\x79\x2c\x62\x30\xcc\xda\xfe\xf2\x11\x93\x49\x6f\x8b\x4e\xbb\xe4\x8d\xcc\x5c\xcb\x88\x0a\x69\xad\x2a\xa6\xed\x15\xa3\x57\x6e\x65\x6a\xcb\xd1\xd5\xab\xfe\x14\x21\x4b\xfb\x95\xcf\x87\xa6\x21\x50\x19\x22\x93\x74\xf0\x41\xa6\xce\x16\x42\x0f\xe4\x76\x3a\xb1\xfe\xce\xa5\xdb\x14\x91\x9e\xc6\x9c\x50\x3a\xcc\x07\xe5\x1e\x4e\x15\xb7\x77\xed\x58\xe3\xcb\x58\xdd\x7a\x8a\xc9\xee\xb4\x35\x6c\xb3\x23\x2f\xc6\x6c\x77\x01\xae\x4e\x23\xf1\x4d\x11\xcc\xe1\x9a\x0b\x88\x1b\x84\xd0\x20\x53\x25\x1b\xa5\xea\x82\x6f\xdb\x7d\xa2\xba\x5d\x4e\xc4\xea\x1c\x51\xce\x7e\x0c\x56\x42\xb3", 197); *(uint64_t*)0x20010810 = 0x20010600; memcpy((void*)0x20010600, "\xd3\x5a\xe8\xf9\xb7\x09\x07\x3a\x47\x20\x79\xb1\x20\x33\xdf\xd0\x9c\x6a\x47\x18\x64\x6c\xd9\x92\xb2\xd1\xcd\x35\x89\x44\x6b\x63\xb3\x0c\x67", 35); *(uint64_t*)0x20010820 = 0x20010640; memcpy((void*)0x20010640, "\x50\x63\xcd\xf3\x58\x9e\xc6\xc7\xb9\x54\x0e\x75\x14\xf9\x5f\xf7\xdf\x32\xde\xdf\xab\x4e", 22); *(uint64_t*)0x20010830 = 0x20010680; memcpy((void*)0x20010680, "\x62\x25\xf8\xbb\x38\x69\x3a\xa6\x54\x11\x30\x1b\x35\x84\x25\x74\xdd\xc4\x0d\x87\x49\x7a\xa2\xf3\xfe\x39\xf7\xb8\xba\xcc\xc1\x0a\x30\xc6\xa9\xd2\xad\x65\x16\xd8\x83\x65\x66\x26\x55\xae\xbd\xb4\x73\x20\x76\x3a\xc2\x8e\xf7\x33\xb2\x02\xbd", 59); *(uint64_t*)0x20010840 = 0x200106c0; memcpy((void*)0x200106c0, "\xf6\xcf\x9e\xee\xc4\xe1\x06\x86\x63\xcd\x86\xfc\x0c\x25\x5f\x05\x1c\x75\x0c\x85\x3d\x1c\xc0\x74\x83\xb7\x3b\x07\x59\xd5\x28\x4e\xbd\x41\xbc\x8d\xb2\x8e\xb7\xb5\xdb\xdf\x72\x21\xd8\x77\x93\x26\x2d\x57\xbc\xab\x11\x99\xa0\xce\xda\x8b\x5e\x4c\x57\x21\x70\x38\xc1\x7f\x96\xf0\xdf\xff\x52\xfa\xc6\x98\xc7\x3c\x2a\x0d\x69\x26\x64\x77\xab\xf5\x78\xc0\x5f\xc5\x0e\x75\xba\x84\x61\x99\x7a\x9c\x6f\xd9\xf0\x61\x89\x51\x60\x90\xd4\x7e\xe8\xd8\x1a\x93\xda\x80\x02\xd8\x8c\xec\xf2\x6d\x3c\xea\xd9\xb5\x9f\x23\x0b\xdc\x46\x26\x6f\xb0\xdc\x76\x08\xcd\xbe\xf0\x37\x74\x6b\xc7\x1c\x1d\x86\x5a\xcf\xf0\x3f\xd5\xaf\xb6\xa4\xea\x9a\x1e\x7f\x0b\x5c\x18\x99\xa2\x87\xe2\xee\x8a\x8d\xa9\xac\x0e\xdc\xc3\x02\xc3\xf9\x6a\x36\x48\x0b\x6c\xb3\x1d\x1e\x29\x78\x7d\x71\x5f\x45\x0d\x3c\x46\x7d\xfc\x4d\xbd\x31\xf3\x56\x2a\xc9\x94\xb2\x63\x4e\x91\xa8\xd3\xea\xa7\x25\x2f\xe0\xdb\x77\xb2\xe6\xda\x55\x4e\x67\xa3\x43\x17\xe3\x8e\x00\x07\xec\x37\xee\x58\x49\x78\xe7\xc0\x9b\x28\x06\xc1\x71", 239); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_stream_readv))(r[1], 0, 0x200107c0, 9, 0x20010880); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(zx_event_create))(0xffe00, 0x200108c0); if (res == ZX_OK) r[2] = *(uint32_t*)0x200108c0; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(0, 0x20010940, 0x20010980); if (res == ZX_OK) r[3] = *(uint32_t*)0x20010980; break; case 6: res = -1; res = ((intptr_t(*)())CAST(get_root_resource))(); if ((int)res != -1) r[4] = res; break; case 7: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vmar_allocate))(r[1], 0x16000000, 0xd7d1, -1, 0x200109c0, 0x20010a00); if (res == ZX_OK) r[5] = *(uint32_t*)0x200109c0; break; case 8: *(uint32_t*)0x20010900 = 0; memset((void*)0x20010904, 0, 3); *(uint8_t*)0x20010907 = 1; *(uint64_t*)0x20010908 = 0x5cd6900b00000000; *(uint64_t*)0x20010910 = 0xfff; *(uint64_t*)0x20010918 = 0; *(uint32_t*)0x20010920 = -1; *(uint32_t*)0x20010924 = 9; *(uint32_t*)0x20010a40 = r[3]; *(uint32_t*)0x20010a44 = r[4]; *(uint32_t*)0x20010a48 = r[5]; *(uint32_t*)0x20010a4c = r[1]; *(uint32_t*)0x20010a50 = r[1]; *(uint32_t*)0x20010a54 = r[1]; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write))(r[2], 0, 0x20010900, 0x28, 0x20010a40, 0x18); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_vcpu_write_state))(r[4], 0x80000001, 0x20010a80, 0xf5); break; case 10: memcpy((void*)0x20000000, "\xc4\x22\x01\x04\x1d\xb2\x3b\xae\x8b\x67\x2e\x26\x41\xc7\x04\xfb\x27\x27\x00\x00\xf0\x41\x0f\xc7\x8b\x95\x42\x4e\xd7\x65\xa2\x0a\x00\x00\x00\x00\x00\x00\x00\xc4\x83\xc9\x5e\x18\x05\xc4\xe2\xb1\x90\x34\x7b\xf2\x0f\x59\x33\x3e\x0f\x38\xf1\x5b\xd2\x3e\xf3\x47\x0f\x2a\x98\xc1\x59\x6e\x05\xc4\x61\xaa\x11\xc1", 76); syz_execute_func(0x20000000); break; case 11: syz_future_time(0); break; case 12: syz_job_default(); break; case 13: syz_mmap(0x20ffd000, 0x2000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :8:10: fatal error: 'lib/ddk/driver.h' file not found #include ^~~~~~~~~~~~~~~~~~ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2112417633 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/9 (0.18s) csource_test.go:131: --- FAIL: TestGenerate/fuchsia/amd64/10 (0.19s) csource_test.go:131: --- FAIL: TestGenerate/fuchsia/amd64/1 (0.20s) csource_test.go:131: --- FAIL: TestGenerate/fuchsia/amd64/8 (0.20s) csource_test.go:131: FAIL FAIL github.com/google/syzkaller/pkg/csource 21.181s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ok github.com/google/syzkaller/pkg/host (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image (cached) ok github.com/google/syzkaller/pkg/instance (cached) ok github.com/google/syzkaller/pkg/ipc (cached) ok github.com/google/syzkaller/pkg/kconfig 0.411s ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig (cached) ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report (cached) ok github.com/google/syzkaller/pkg/repro (cached) ok github.com/google/syzkaller/pkg/runtest (cached) ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem (cached) ok github.com/google/syzkaller/pkg/subsystem/linux (cached) ok github.com/google/syzkaller/pkg/subsystem/lists (cached) ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ok github.com/google/syzkaller/prog (cached) ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci (cached) ok github.com/google/syzkaller/syz-fuzzer (cached) ok github.com/google/syzkaller/syz-hub (cached) ok github.com/google/syzkaller/syz-hub/state (cached) ok github.com/google/syzkaller/syz-manager (cached) ok github.com/google/syzkaller/syz-verifier (cached) ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/parser (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/proggen (cached) ok github.com/google/syzkaller/vm (cached) ok github.com/google/syzkaller/vm/isolated (cached) ok github.com/google/syzkaller/vm/proxyapp (cached) ok github.com/google/syzkaller/vm/vmimpl (cached) FAIL