? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/pkg/debugtracer [no test files] ? github.com/google/syzkaller/pkg/gce [no test files] ? github.com/google/syzkaller/pkg/gcs [no test files] ? github.com/google/syzkaller/pkg/hash [no test files] ? github.com/google/syzkaller/pkg/html/pages [no test files] ? github.com/google/syzkaller/pkg/ifuzz/iset [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc [no test files] ? github.com/google/syzkaller/pkg/ifuzz/powerpc/generated [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86 [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/x86/generated [no test files] ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] ? github.com/google/syzkaller/pkg/report/crash [no test files] ? github.com/google/syzkaller/pkg/rpctype [no test files] ? github.com/google/syzkaller/pkg/signal [no test files] ? github.com/google/syzkaller/pkg/testutil [no test files] ? github.com/google/syzkaller/pkg/tools [no test files] ? 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/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [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/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] ok github.com/google/syzkaller/executor 2.571s ok github.com/google/syzkaller/pkg/asset (cached) ok github.com/google/syzkaller/pkg/ast 0.723s ok github.com/google/syzkaller/pkg/auth (cached) ok github.com/google/syzkaller/pkg/bisect (cached) ok github.com/google/syzkaller/pkg/bisect/minimize (cached) ok github.com/google/syzkaller/pkg/build (cached) ok github.com/google/syzkaller/pkg/compiler 3.159s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover (cached) ok github.com/google/syzkaller/pkg/cover/backend (cached) ? 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] --- FAIL: TestGenerate (20.47s) --- FAIL: TestGenerate/fuchsia/amd64 (0.05s) testutil.go:33: seed=1690338775936303545 testutil.go:33: seed=1690338775985930990 --- FAIL: TestGenerate/fuchsia/amd64/0 (0.44s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); syz_execute_func(/*text=*/0x20000000); syz_future_time(/*when=*/1); syz_job_default(); syz_mmap(/*addr=*/0x20ffb000, /*len=*/0x4000); 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; } :134:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2415625861 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/14 (0.50s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 2; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :271:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2294597854 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/2 (0.51s) csource_test.go:150: opts: {Threaded:true Repeat:false RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "/tmp/syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void loop(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); 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; } :261:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3916580831 -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.52s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } :269:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2438046060 -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.52s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :267:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor903238154 -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.52s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :267:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2577537633 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/10 (0.56s) csource_test.go:150: opts: {Threaded:true Repeat:true RepeatTimes:0 Procs:0 Slowdown:1 Sandbox:none SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:false HandleSegv:false Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} program: zx_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) syz_process_self() syz_thread_self() syz_vmar_root_self() csource_test.go:151: failed to build program: // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static int inject_fault(int nth) { return 0; } static void setup_fault() { } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) usleep(200); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout_ms) { uint64_t start = current_time_ms(); for (;;) { if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; if (current_time_ms() - start > timeout_ms) return 0; usleep(200); } } long syz_mmap(size_t addr, size_t size) { zx_handle_t root = zx_vmar_root_self(); zx_info_vmar_t info; zx_status_t status = zx_object_get_info(root, ZX_INFO_VMAR, &info, sizeof(info), 0, 0); if (status != ZX_OK) { return status; } zx_handle_t vmo; status = zx_vmo_create(size, 0, &vmo); if (status != ZX_OK) { return status; } uintptr_t mapped_addr; status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE, addr - info.base, vmo, 0, size, &mapped_addr); zx_status_t close_vmo_status = zx_handle_close(vmo); if (close_vmo_status != ZX_OK) { } return status; } static long syz_process_self(void) { return zx_process_self(); } static long syz_thread_self(void) { return zx_thread_self(); } static long syz_vmar_root_self(void) { return zx_vmar_root_self(); } static long syz_job_default(void) { return zx_job_default(); } static long syz_future_time(volatile long when) { zx_time_t delta_ms = 10000; switch (when) { case 0: delta_ms = 5; break; case 1: delta_ms = 30; break; } zx_time_t now = 0; zx_clock_read(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } #define CAST(f) ({void* p = (void*)f; p; }) static long syz_execute_func(volatile long text) { ((void (*)(void))(text))(); return 0; } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 17; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (call == 1) break; event_timedwait(&th->done, 50); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); static void loop(void) { execute_one(); } uint64_t r[3] = {0x0, 0x0, 0x0}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: inject_fault(1); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); do_sandbox_none(); return 0; } :255:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor3960988937 -DGOOS_fuchsia=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -Wno-deprecated -target x86_64-fuchsia -ldriver -lfdio -lzircon --sysroot /syzkaller/shared/fuchsia/out/x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot -I /syzkaller/shared/fuchsia/sdk/lib/fdio/include -I /syzkaller/shared/fuchsia/zircon/system/ulib/fidl/include -I /syzkaller/shared/fuchsia/src/lib/ddk/include -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.device.manager -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.nand -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.power.statecontrol -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/sdk/fidl/fuchsia.hardware.usb.peripheral -I /syzkaller/shared/fuchsia/out/x64/fidling/gen/zircon/vdso/zx -L /syzkaller/shared/fuchsia/out/x64/x64-shared -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-array-bounds -Wno-unused-command-line-argument] --- FAIL: TestGenerate/fuchsia/amd64/6 (0.54s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); do_sandbox_none(); return 0; } :267:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2628857202 -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.54s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); 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; } :269:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2504934654 -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.54s) 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_system_get_performance_info(0x0, 0x1, 0x1, &(0x7f0000000000)=""/125, &(0x7f0000000080)) (fail_nth: 1) zx_eventpair_create$VALID_OPTIONS(0x0, &(0x7f00000001c0)=0x0, &(0x7f0000000200)=0x0) (async) zx_channel_create$fuchsia_scpi_SystemController(0x0, &(0x7f0000000240)=0x0, &(0x7f0000000280)) (rerun: 4) zx_channel_write_etc$ZX_CHANNEL_IOVEC(0x0, 0x2, &(0x7f00000000c0)="1886fe5e57dc1278603a6724b0d8a66e54fd6c3e2a83433d98f6b3633c98de8f6fcb325413e24c61273cce8bca877f460ef57c5cc15bd728d12040916bb85fe335301a0099f5a4ead8015f8706b39c9c3ff17f900b8f624f2fcc9576e31cd311d23aa7cd4b77c7e1bd84b909f84420a0dab65908d1829595057d211dd1b6c5df388c5a1f93190d4e7ee1470662d118503fd9fc59335ba855bca6ed77d029bc271fe7385579d7f3859f655509697e8269fa069b4c1c502d766782614e042e18c5fdf038020dd1fa732fa8396a3344da", 0xcf, &(0x7f00000002c0)=[{0x8001, 0x0, 0x6, 0x9, 0xab4}, {0x80000000, r1, 0x1, 0xffff, 0x9}, {0xffff, r2, 0x3c39, 0x8, 0x9}, {0x6, 0x0, 0x7, 0x7c49b9b4, 0x40}], 0x4) zx_system_powerctl(r0, 0x7, &(0x7f0000000340)=@acpi={{0x3, 0x3, 0x75}, "62a105e56ee0286a6e"}) zx_channel_call$fuchsia_cobalt_LoggerBaseLogEventCount(r1, 0x0, 0x7fffffffffffffff, &(0x7f0000010440)={&(0x7f0000000380)={{}, 0xfffffffe, 0x80000000, {0xfc62, 0xffffffffffffffff}, 0x7, 0x7fffffffffffffff, {'^{\x8e)\\*^&'}}, &(0x7f00000003c0), &(0x7f0000000400), &(0x7f0000010400), 0x40, 0x0, 0x10000}, &(0x7f0000010480), &(0x7f00000104c0)) zx_task_create_exception_channel(r1, 0x0, &(0x7f0000010500)) zx_object_get_info$ZX_INFO_TASK_RUNTIME(r1, 0x1000001e, &(0x7f0000010540), 0x20, &(0x7f0000010580), &(0x7f00000105c0)) zx_channel_create$fuchsia_cobalt_LoggerBase(0x0, &(0x7f0000010600), &(0x7f0000010640)) zx_channel_call$fuchsia_io_DirectoryAdminClose(0x0, 0x0, 0x7fffffffffffffff, &(0x7f0000020900)={&(0x7f0000010840), &(0x7f0000010880), &(0x7f00000108c0), &(0x7f00000208c0), 0x10, 0x0, 0x10000}, &(0x7f0000020940), &(0x7f0000020980)) syz_execute_func(&(0x7f0000000000)="660f3acf450008c483795e1100f2def665f001bd210000003e0f00c4c4417f2cf965f34590c4c3810d8618bde120000f38ca9c5687240000c4c2f0f5c6") syz_future_time(0x1) syz_job_default() syz_mmap(&(0x7f0000ffb000/0x4000)=nil, 0x4000) 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))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); break; case 1: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_eventpair_create))(/*options=*/0, /*out0=*/0x200001c0, /*out1=*/0x20000200); if (res == ZX_OK) { r[0] = *(uint32_t*)0x200001c0; r[1] = *(uint32_t*)0x20000200; } break; case 2: res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); { int i; for(i = 0; i < 4; i++) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20000240, /*out1=*/0x20000280); } } if (res == ZX_OK) r[2] = *(uint32_t*)0x20000240; break; case 3: memcpy((void*)0x200000c0, "\x18\x86\xfe\x5e\x57\xdc\x12\x78\x60\x3a\x67\x24\xb0\xd8\xa6\x6e\x54\xfd\x6c\x3e\x2a\x83\x43\x3d\x98\xf6\xb3\x63\x3c\x98\xde\x8f\x6f\xcb\x32\x54\x13\xe2\x4c\x61\x27\x3c\xce\x8b\xca\x87\x7f\x46\x0e\xf5\x7c\x5c\xc1\x5b\xd7\x28\xd1\x20\x40\x91\x6b\xb8\x5f\xe3\x35\x30\x1a\x00\x99\xf5\xa4\xea\xd8\x01\x5f\x87\x06\xb3\x9c\x9c\x3f\xf1\x7f\x90\x0b\x8f\x62\x4f\x2f\xcc\x95\x76\xe3\x1c\xd3\x11\xd2\x3a\xa7\xcd\x4b\x77\xc7\xe1\xbd\x84\xb9\x09\xf8\x44\x20\xa0\xda\xb6\x59\x08\xd1\x82\x95\x95\x05\x7d\x21\x1d\xd1\xb6\xc5\xdf\x38\x8c\x5a\x1f\x93\x19\x0d\x4e\x7e\xe1\x47\x06\x62\xd1\x18\x50\x3f\xd9\xfc\x59\x33\x5b\xa8\x55\xbc\xa6\xed\x77\xd0\x29\xbc\x27\x1f\xe7\x38\x55\x79\xd7\xf3\x85\x9f\x65\x55\x09\x69\x7e\x82\x69\xfa\x06\x9b\x4c\x1c\x50\x2d\x76\x67\x82\x61\x4e\x04\x2e\x18\xc5\xfd\xf0\x38\x02\x0d\xd1\xfa\x73\x2f\xa8\x39\x6a\x33\x44\xda", 207); *(uint32_t*)0x200002c0 = 0x8001; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 6; *(uint32_t*)0x200002cc = 9; *(uint32_t*)0x200002d0 = 0xab4; *(uint32_t*)0x200002d4 = 0x80000000; *(uint32_t*)0x200002d8 = r[1]; *(uint32_t*)0x200002dc = 1; *(uint32_t*)0x200002e0 = 0xffff; *(uint32_t*)0x200002e4 = 9; *(uint32_t*)0x200002e8 = 0xffff; *(uint32_t*)0x200002ec = r[2]; *(uint32_t*)0x200002f0 = 0x3c39; *(uint32_t*)0x200002f4 = 8; *(uint32_t*)0x200002f8 = 9; *(uint32_t*)0x200002fc = 6; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 7; *(uint32_t*)0x20000308 = 0x7c49b9b4; *(uint32_t*)0x2000030c = 0x40; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_write_etc))(/*handle=*/0, /*options=*/2, /*bytes=*/0x200000c0, /*num_bytes=*/0xcf, /*handles=*/0x200002c0, /*num_handles=*/4); break; case 4: *(uint8_t*)0x20000340 = 3; *(uint8_t*)0x20000341 = 3; *(uint8_t*)0x20000342 = 0x75; memcpy((void*)0x20000343, "\x62\xa1\x05\xe5\x6e\xe0\x28\x6a\x6e", 9); ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_system_powerctl))(/*res=*/r[0], /*cmd=*/7, /*arg=*/0x20000340); break; case 5: *(uint64_t*)0x20010440 = 0x20000380; *(uint32_t*)0x20000380 = 0; memset((void*)0x20000384, 0, 3); *(uint8_t*)0x20000387 = 1; *(uint64_t*)0x20000388 = 0x6fce776500000000; *(uint32_t*)0x20000390 = 0xfffffffe; *(uint32_t*)0x20000394 = 0x80000000; *(uint64_t*)0x20000398 = 0xfc62; *(uint64_t*)0x200003a0 = -1; *(uint64_t*)0x200003a8 = 7; *(uint64_t*)0x200003b0 = 0x7fffffffffffffff; memcpy((void*)0x200003b8, "^{\216)\\*^&", 8); *(uint64_t*)0x20010448 = 0x200003c0; *(uint64_t*)0x20010450 = 0x20000400; *(uint64_t*)0x20010458 = 0x20010400; *(uint32_t*)0x20010460 = 0x40; *(uint32_t*)0x20010464 = 0; *(uint32_t*)0x20010468 = 0x10000; *(uint32_t*)0x2001046c = 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=*/0x20010440, /*actual_bytes=*/0x20010480, /*actual_handles=*/0x200104c0); break; case 6: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_task_create_exception_channel))(/*task=*/r[1], /*options=*/0, /*out=*/0x20010500); break; case 7: ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_object_get_info))(/*handle=*/r[1], /*topic=*/0x1000001e, /*buffer=*/0x20010540, /*buffer_size=*/0x20, /*actual=*/0x20010580, /*avail=*/0x200105c0); break; case 8: ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(zx_channel_create))(/*options=*/0, /*out0=*/0x20010600, /*out1=*/0x20010640); break; case 9: *(uint64_t*)0x20020900 = 0x20010840; *(uint32_t*)0x20010840 = 0; memset((void*)0x20010844, 0, 3); *(uint8_t*)0x20010847 = 1; *(uint64_t*)0x20010848 = 0x52b9568700000000; *(uint64_t*)0x20020908 = 0x20010880; *(uint64_t*)0x20020910 = 0x200108c0; *(uint64_t*)0x20020918 = 0x200208c0; *(uint32_t*)0x20020920 = 0x10; *(uint32_t*)0x20020924 = 0; *(uint32_t*)0x20020928 = 0x10000; *(uint32_t*)0x2002092c = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_channel_call))(/*handle=*/0, /*options=*/0, /*deadline=*/0x7fffffffffffffff, /*args=*/0x20020900, /*actual_bytes=*/0x20020940, /*actual_handles=*/0x20020980); break; case 10: memcpy((void*)0x20000000, "\x66\x0f\x3a\xcf\x45\x00\x08\xc4\x83\x79\x5e\x11\x00\xf2\xde\xf6\x65\xf0\x01\xbd\x21\x00\x00\x00\x3e\x0f\x00\xc4\xc4\x41\x7f\x2c\xf9\x65\xf3\x45\x90\xc4\xc3\x81\x0d\x86\x18\xbd\xe1\x20\x00\x0f\x38\xca\x9c\x56\x87\x24\x00\x00\xc4\xc2\xf0\xf5\xc6", 61); 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=*/0x20ffb000, /*len=*/0x4000); break; case 14: syz_process_self(); break; case 15: syz_thread_self(); break; case 16: syz_vmar_root_self(); break; } } int main(void) { syz_mmap(/*addr=*/0x20000000, /*len=*/0x1000000); setup_fault(); use_temporary_dir(); loop(); return 0; } :261:66: error: use of undeclared identifier 'zx_system_get_performance_info' ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(zx_system_get_performance_info))(/*res=*/0, /*topic=*/1, /*count=*/1, /*info=*/0x20000000, /*output_count=*/0x20000080); ^ 1 error generated. compiler invocation: /syzkaller/shared/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang [-o /tmp/syz-executor2057002236 -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.54s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/4 (0.54s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/13 (0.55s) csource_test.go:148: --- FAIL: TestGenerate/fuchsia/amd64/1 (0.55s) csource_test.go:148: FAIL FAIL github.com/google/syzkaller/pkg/csource 22.681s 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 (cached) ok github.com/google/syzkaller/pkg/html (cached) ok github.com/google/syzkaller/pkg/ifuzz (cached) ok github.com/google/syzkaller/pkg/image (cached) ok github.com/google/syzkaller/pkg/instance (cached) ok github.com/google/syzkaller/pkg/ipc (cached) ok github.com/google/syzkaller/pkg/kconfig (cached) ok github.com/google/syzkaller/pkg/kd (cached) ok github.com/google/syzkaller/pkg/log (cached) ok github.com/google/syzkaller/pkg/mgrconfig (cached) ok github.com/google/syzkaller/pkg/osutil (cached) ok github.com/google/syzkaller/pkg/report (cached) ok github.com/google/syzkaller/pkg/repro (cached) ok github.com/google/syzkaller/pkg/runtest 50.619s ok github.com/google/syzkaller/pkg/serializer (cached) ok github.com/google/syzkaller/pkg/stats (cached) ok github.com/google/syzkaller/pkg/subsystem (cached) ok github.com/google/syzkaller/pkg/subsystem/linux (cached) ok github.com/google/syzkaller/pkg/subsystem/lists (cached) ok github.com/google/syzkaller/pkg/symbolizer (cached) ok github.com/google/syzkaller/pkg/tool (cached) ok github.com/google/syzkaller/pkg/vcs (cached) ok github.com/google/syzkaller/prog (cached) ok github.com/google/syzkaller/prog/test (cached) ok github.com/google/syzkaller/sys/linux (cached) ok github.com/google/syzkaller/sys/netbsd (cached) ok github.com/google/syzkaller/sys/openbsd (cached) ok github.com/google/syzkaller/syz-ci (cached) ok github.com/google/syzkaller/syz-fuzzer (cached) ok github.com/google/syzkaller/syz-hub (cached) ok github.com/google/syzkaller/syz-hub/state (cached) ok github.com/google/syzkaller/syz-manager (cached) ok github.com/google/syzkaller/syz-verifier (cached) ok github.com/google/syzkaller/tools/syz-kconf (cached) ok github.com/google/syzkaller/tools/syz-linter (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/parser (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/proggen (cached) ok github.com/google/syzkaller/vm (cached) ok github.com/google/syzkaller/vm/isolated (cached) ok github.com/google/syzkaller/vm/proxyapp (cached) ok github.com/google/syzkaller/vm/vmimpl (cached) FAIL