? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ? github.com/google/syzkaller/pkg/html/pages [no test files] ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ok github.com/google/syzkaller/executor 4.936s ok github.com/google/syzkaller/pkg/asset (cached) ok github.com/google/syzkaller/pkg/ast 1.371s ok github.com/google/syzkaller/pkg/auth (cached) ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ? github.com/google/syzkaller/pkg/report/crash [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/signal [no test files] ? github.com/google/syzkaller/pkg/stats/syzbotstats [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ok github.com/google/syzkaller/pkg/bisect 50.673s ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build 43.188s ok github.com/google/syzkaller/pkg/compiler 6.866s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover 77.263s ok github.com/google/syzkaller/pkg/cover/backend 0.862s --- FAIL: TestGenerate (57.70s) --- FAIL: TestGenerate/fuchsia/amd64 (0.08s) testutil.go:33: seed=1698049863976886630 testutil.go:33: seed=1698049864055874953 --- FAIL: TestGenerate/fuchsia/amd64/0 (0.90s) csource_test.go:150: opts: {Threaded:false Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_one(void) { intptr_t res = 0; inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); syz_future_time(/*when=*/1); syz_job_default(); syz_mmap(/*addr=*/0x20ffd000, /*len=*/0x2000); syz_process_self(); syz_thread_self(); syz_vmar_root_self(); } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :173:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3635522710 -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.90s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :320:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1646536922 -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 (4.85s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:true LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { fprintf(stderr, "### start\n"); int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); fprintf(stderr, "### call=0 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); fprintf(stderr, "### call=1 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); 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))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); fprintf(stderr, "### call=3 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 4: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); fprintf(stderr, "### call=4 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); fprintf(stderr, "### call=5 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); fprintf(stderr, "### call=6 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); fprintf(stderr, "### call=7 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); fprintf(stderr, "### call=8 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 9: res = -1; errno = EFAULT; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); fprintf(stderr, "### call=9 errno=%u\n", (intptr_t)(int)res == -1 ? errno : 0); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); res = -1; errno = EFAULT; res = syz_execute_func(/*text=*/0x20000000); fprintf(stderr, "### call=10 errno=%u\n", res == -1 ? errno : 0); break; case 11: res = -1; errno = EFAULT; res = syz_future_time(/*when=*/1); fprintf(stderr, "### call=11 errno=%u\n", res == -1 ? errno : 0); break; case 12: res = -1; errno = EFAULT; res = syz_job_default(); fprintf(stderr, "### call=12 errno=%u\n", res == -1 ? errno : 0); break; case 13: res = -1; errno = EFAULT; res = syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :337:81: error: use of undeclared identifier 'zx_channel_call_etc' res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor534488529 -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 (4.88s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:2 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:true Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :322:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor1618358881 -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 (4.84s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:10 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 500); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :318:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor902935940 -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.24s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:10 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :318:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor166532008 -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.25s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:9223372036854775807 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :318:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor759252959 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/8 (0.28s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:-9223372036854775808 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :318:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor636954718 -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.28s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :320:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3474001772 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/7 (0.29s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_object_get_info$ZX_INFO_HANDLE_COUNT(0x0, 0x13, &(0x7f0000000000), 0x4, &(0x7f0000000040), &(0x7f0000000080)) (fail_nth: 1) zx_mtrace_control(0x0, 0x778b0000, 0x1, 0xb3, &(0x7f00000000c0)="f1bade5e835d6ba460346924a5884672e24fa30d80ef4891832e140a472af2460f0a88d89a5bfe7b50a5e5e4a784eea7a974c6ccd5322f8a0b89155cb9b5b70e069efb32d7746c2b9c30fd85f933b7949b32f2d9e71245caf665c5ac49d6899b375aee68580b406eaadcba550eef776056e9a084a44bdaeecda7e3e6b1d6d55efb6ed5ae21a11344ecb2be7a91b5e27e331b6fd603d60f02e80632292bb6defe7bdd76765d448a74b206560974c2d782ebe4c9b72b42f938438d168b160cbe4df07669909eb94d", 0xc7) (async) zx_clock_update(0x0, 0x0, &(0x7f00000001c0)={0x7fffffff, 0x8, 0x0, 0xfffffffffffffffc, 0x1}) (rerun: 4) fdio_service_connect$fuchsia_net_NameLookup(&(0x7f0000000200), 0x0) zx_msi_allocate(0x0, 0x19, &(0x7f0000000280)=0x0) zx_channel_create$fuchsia_io_Directory(0x0, &(0x7f00000002c0)=0x0, &(0x7f0000000300)=0x0) zx_channel_call_etc(0x0, 0x2, 0x0, &(0x7f00000004c0)={&(0x7f0000000240)="77f053ad06ff", &(0x7f0000000340)=[0x0, r0, r2], &(0x7f0000000380)=""/232, &(0x7f0000000480)=[0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x6, 0x3, 0xe8, 0x6}, &(0x7f0000000500), &(0x7f0000000540)) zx_channel_call$fuchsia_io_DirectorySync(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010640)={&(0x7f0000000580), &(0x7f00000005c0), &(0x7f0000000600), &(0x7f0000010600), 0x10, 0x0, 0x10000}, &(0x7f0000010680), &(0x7f00000106c0)) zx_channel_call$fuchsia_io_FileSetAttr(0x0, 0x0, 0x0, &(0x7f0000020800)={&(0x7f0000010700)={{}, 0x5, {0x1, 0xfffffffffffff000, 0x7, 0x768166bd, 0x10000, 0x5, 0x1}}, &(0x7f0000010780), &(0x7f00000107c0), &(0x7f00000207c0), 0x48, 0x0, 0x10000}, &(0x7f0000020840), &(0x7f0000020880)) zx_clock_get_details(0x0, 0x400000000000000, &(0x7f0000020940)) syz_execute_func(&(0x7f0000000000)="460f0fbf376b0bd996c46235a944eb04c482d3f59ed3500000d8b8ecbd0000c463dd680800c4220992440f1dc4c2b0f732c4c179514e5af20f1afcc4e2019c9a76000000") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/0, /*topic=*/0x13, /*buffer=*/0x20000000, /*buffer_size=*/4, /*actual=*/0x20000040, /*avail=*/0x20000080); break; case 1: memcpy((void*)0x200000c0, "\xf1\xba\xde\x5e\x83\x5d\x6b\xa4\x60\x34\x69\x24\xa5\x88\x46\x72\xe2\x4f\xa3\x0d\x80\xef\x48\x91\x83\x2e\x14\x0a\x47\x2a\xf2\x46\x0f\x0a\x88\xd8\x9a\x5b\xfe\x7b\x50\xa5\xe5\xe4\xa7\x84\xee\xa7\xa9\x74\xc6\xcc\xd5\x32\x2f\x8a\x0b\x89\x15\x5c\xb9\xb5\xb7\x0e\x06\x9e\xfb\x32\xd7\x74\x6c\x2b\x9c\x30\xfd\x85\xf9\x33\xb7\x94\x9b\x32\xf2\xd9\xe7\x12\x45\xca\xf6\x65\xc5\xac\x49\xd6\x89\x9b\x37\x5a\xee\x68\x58\x0b\x40\x6e\xaa\xdc\xba\x55\x0e\xef\x77\x60\x56\xe9\xa0\x84\xa4\x4b\xda\xee\xcd\xa7\xe3\xe6\xb1\xd6\xd5\x5e\xfb\x6e\xd5\xae\x21\xa1\x13\x44\xec\xb2\xbe\x7a\x91\xb5\xe2\x7e\x33\x1b\x6f\xd6\x03\xd6\x0f\x02\xe8\x06\x32\x29\x2b\xb6\xde\xfe\x7b\xdd\x76\x76\x5d\x44\x8a\x74\xb2\x06\x56\x09\x74\xc2\xd7\x82\xeb\xe4\xc9\xb7\x2b\x42\xf9\x38\x43\x8d\x16\x8b\x16\x0c\xbe\x4d\xf0\x76\x69\x90\x9e\xb9\x4d", 199); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_mtrace_control))(/*handle=*/0, /*kind=*/0x778b0000, /*action=*/1, /*options=*/0xb3, /*ptr=*/0x200000c0, /*ptr_size=*/0xc7); break; case 2: *(uint32_t*)0x200001c0 = 0x7fffffff; *(uint32_t*)0x200001c4 = 8; *(uint64_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0xfffffffffffffffc; *(uint64_t*)0x200001d8 = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_update))(/*handle=*/0, /*option=*/0, /*args=*/0x200001c0); } } break; case 3: memcpy((void*)0x20000200, "/svc/fuchsia.net.NameLookup\000", 28); ((intptr_t(*)(intptr_t,intptr_t))CAST(fdio_service_connect))(/*path=*/0x20000200, /*handle=*/0); break; case 4: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_msi_allocate))(/*handle=*/0, /*count=*/0x19, /*out_allocation=*/0x20000280); if (res == ZX_OK) r[0] = *(uint32_t*)0x20000280; break; case 5: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x200002c0, /*out1=*/0x20000300); if (res == ZX_OK) { r[1] = *(uint32_t*)0x200002c0; r[2] = *(uint32_t*)0x20000300; } break; case 6: *(uint64_t*)0x200004c0 = 0x20000240; memcpy((void*)0x20000240, "\x77\xf0\x53\xad\x06\xff", 6); *(uint64_t*)0x200004c8 = 0x20000340; *(uint32_t*)0x20000340 = 0; *(uint32_t*)0x20000344 = r[0]; *(uint32_t*)0x20000348 = r[2]; *(uint64_t*)0x200004d0 = 0x20000380; *(uint64_t*)0x200004d8 = 0x20000480; *(uint32_t*)0x200004e0 = 6; *(uint32_t*)0x200004e4 = 3; *(uint32_t*)0x200004e8 = 0xe8; *(uint32_t*)0x200004ec = 6; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); break; case 7: *(uint64_t*)0x20010640 = 0x20000580; *(uint32_t*)0x20000580 = 0; memset((void*)0x20000584, 0, 3); *(uint8_t*)0x20000587 = 1; *(uint64_t*)0x20000588 = 0x62423faa00000000; *(uint64_t*)0x20010648 = 0x200005c0; *(uint64_t*)0x20010650 = 0x20000600; *(uint64_t*)0x20010658 = 0x20010600; *(uint32_t*)0x20010660 = 0x10; *(uint32_t*)0x20010664 = 0; *(uint32_t*)0x20010668 = 0x10000; *(uint32_t*)0x2001066c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/r[1], /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20010640, /*actual_bytes=*/0x20010680, /*actual_handles=*/0x200106c0); break; case 8: *(uint64_t*)0x20020800 = 0x20010700; *(uint32_t*)0x20010700 = 0; memset((void*)0x20010704, 0, 3); *(uint8_t*)0x20010707 = 1; *(uint64_t*)0x20010708 = 0xbd5559a00000000; *(uint32_t*)0x20010710 = 5; *(uint32_t*)0x20010714 = 1; *(uint64_t*)0x20010718 = 0xfffffffffffff000; *(uint64_t*)0x20010720 = 7; *(uint64_t*)0x20010728 = 0x768166bd; *(uint64_t*)0x20010730 = 0x10000; *(uint64_t*)0x20010738 = 5; *(uint64_t*)0x20010740 = 1; *(uint64_t*)0x20020808 = 0x20010780; *(uint64_t*)0x20020810 = 0x200107c0; *(uint64_t*)0x20020818 = 0x200207c0; *(uint32_t*)0x20020820 = 0x48; *(uint32_t*)0x20020824 = 0; *(uint32_t*)0x20020828 = 0x10000; *(uint32_t*)0x2002082c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0, /*args=*/0x20020800, /*actual_bytes=*/0x20020840, /*actual_handles=*/0x20020880); break; case 9: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_clock_get_details))(/*handle=*/0, /*option=*/0x400000000000000, /*details=*/0x20020940); break; case 10: memcpy((void*)0x20000000, "\x46\x0f\x0f\xbf\x37\x6b\x0b\xd9\x96\xc4\x62\x35\xa9\x44\xeb\x04\xc4\x82\xd3\xf5\x9e\xd3\x50\x00\x00\xd8\xb8\xec\xbd\x00\x00\xc4\x63\xdd\x68\x08\x00\xc4\x22\x09\x92\x44\x0f\x1d\xc4\xc2\xb0\xf7\x32\xc4\xc1\x79\x51\x4e\x5a\xf2\x0f\x1a\xfc\xc4\xe2\x01\x9c\x9a\x76\x00\x00\x00", 68); syz_execute_func(/*text=*/0x20000000); break; case 11: syz_future_time(/*when=*/1); break; case 12: syz_job_default(); break; case 13: syz_mmap(/*addr=*/0x20ffd000, /*len=*/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(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); loop(); return 0; } :312:75: error: use of undeclared identifier 'zx_channel_call_etc' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call_etc))(/*handle=*/0, /*options=*/2, /*deadline=*/0, /*args=*/0x200004c0, /*actual_bytes=*/0x20000500, /*actual_handles=*/0x20000540); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2945869917 -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.29s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/10 (0.44s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/1 (0.43s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/2 (0.43s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 71.509s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ok github.com/google/syzkaller/pkg/email/lore (cached) ok github.com/google/syzkaller/pkg/host 45.738s ok github.com/google/syzkaller/pkg/html (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image 3.216s ok github.com/google/syzkaller/pkg/instance 10.387s ok github.com/google/syzkaller/pkg/ipc 70.254s ok github.com/google/syzkaller/pkg/kconfig (cached) ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig 9.602s ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report 46.280s ok github.com/google/syzkaller/pkg/repro 9.832s ok github.com/google/syzkaller/pkg/runtest 115.364s 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) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/darwin [no test files] ? github.com/google/syzkaller/sys/darwin/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ? github.com/google/syzkaller/sys/openbsd/gen [no test files] ? github.com/google/syzkaller/sys/syz-extract [no test files] ? github.com/google/syzkaller/sys/syz-sysgen [no test files] ? github.com/google/syzkaller/sys/targets [no test files] ? github.com/google/syzkaller/sys/test [no test files] ? github.com/google/syzkaller/sys/test/gen [no test files] ? github.com/google/syzkaller/sys/trusty [no test files] ? github.com/google/syzkaller/sys/trusty/gen [no test files] ? github.com/google/syzkaller/sys/windows [no test files] ? github.com/google/syzkaller/sys/windows/gen [no test files] ? github.com/google/syzkaller/syz-runner [no test files] ? github.com/google/syzkaller/tools/syz-benchcmp [no test files] ? github.com/google/syzkaller/tools/syz-bisect [no test files] ? github.com/google/syzkaller/tools/syz-build [no test files] ? github.com/google/syzkaller/tools/syz-check [no test files] ? github.com/google/syzkaller/tools/syz-cover [no test files] ? github.com/google/syzkaller/tools/syz-crush [no test files] ? github.com/google/syzkaller/tools/syz-db [no test files] ? github.com/google/syzkaller/tools/syz-execprog [no test files] ? github.com/google/syzkaller/tools/syz-expand [no test files] ? github.com/google/syzkaller/tools/syz-fillreports [no test files] ? github.com/google/syzkaller/tools/syz-fmt [no test files] ? github.com/google/syzkaller/tools/syz-hubtool [no test files] ? github.com/google/syzkaller/tools/syz-imagegen [no test files] ? github.com/google/syzkaller/tools/syz-kcidb [no test files] ? github.com/google/syzkaller/tools/syz-lore [no test files] ? github.com/google/syzkaller/tools/syz-make [no test files] ? github.com/google/syzkaller/tools/syz-minconfig [no test files] ? github.com/google/syzkaller/tools/syz-mutate [no test files] ? github.com/google/syzkaller/tools/syz-prog2c [no test files] ? github.com/google/syzkaller/tools/syz-query-subsystems [no test files] ? github.com/google/syzkaller/tools/syz-reporter [no test files] ? github.com/google/syzkaller/tools/syz-repro [no test files] ? github.com/google/syzkaller/tools/syz-reprolist [no test files] ? github.com/google/syzkaller/tools/syz-runtest [no test files] ? github.com/google/syzkaller/tools/syz-showprio [no test files] ? github.com/google/syzkaller/tools/syz-stress [no test files] ? github.com/google/syzkaller/tools/syz-symbolize [no test files] ? github.com/google/syzkaller/tools/syz-testbed [no test files] ? github.com/google/syzkaller/tools/syz-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ? github.com/google/syzkaller/tools/syz-tty [no test files] ? github.com/google/syzkaller/tools/syz-upgrade [no test files] ? github.com/google/syzkaller/tools/syz-usbgen [no test files] ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/cuttlefish [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/proxyapp/mocks [no test files] ? github.com/google/syzkaller/vm/proxyapp/proxyrpc [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ? github.com/google/syzkaller/vm/starnix [no test files] ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] ok github.com/google/syzkaller/prog 21.081s ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux 0.248s ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci 2.986s ok github.com/google/syzkaller/syz-fuzzer 0.543s ok github.com/google/syzkaller/syz-hub 0.031s ok github.com/google/syzkaller/syz-hub/state 0.099s ok github.com/google/syzkaller/syz-manager 3.913s ok github.com/google/syzkaller/syz-verifier 3.158s ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/parser 0.014s ok github.com/google/syzkaller/tools/syz-trace2syz/proggen 0.302s ok github.com/google/syzkaller/vm 10.914s ok github.com/google/syzkaller/vm/isolated 2.782s ok github.com/google/syzkaller/vm/proxyapp 5.329s ok github.com/google/syzkaller/vm/vmimpl 2.900s FAIL