ok github.com/google/syzkaller/dashboard/app (cached) ? github.com/google/syzkaller/dashboard/dashapi [no test files] ok github.com/google/syzkaller/executor 1.090s ok github.com/google/syzkaller/pkg/ast 3.121s --- FAIL: TestBisectionResults (8.75s) --- FAIL: TestBisectionResults/group (0.00s) --- FAIL: TestBisectionResults/group/cause-finds-cause-baseline-broken-build (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test780280403/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-finds-cause-minimize-fails (7.86s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test010634842/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/fix-same-binary (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test497095056/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-finds-cause-baseline-fails (7.86s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test206821532/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-finds-cause (7.87s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test000270056/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-finds-cause-baseline-skip (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test920952751/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-inconclusive (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test599286584/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/fix-finds-fix (7.86s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test579472430/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-same-binary-off-by-one-2 (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test257910594/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/fix-release (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test790894020/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-not-in-previous-release-issue-1527 (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test766353917/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-finds-cause-baseline-does-not-repro (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test094338871/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/fix-same-binary-last (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test975898006/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-same-binary-release3 (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test743363201/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-crashes-oldest (7.85s) git_test_util.go:73: failed to start /usr/bin/git [git log --format=%H%n%s%n%ae%n%an%n%ad%n%P%n%cd%n%b -n 1 HEAD]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/all-releases-broken (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test527312825/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-same-binary-off-by-one (7.86s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test563880779/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/fix-crashes-HEAD (7.82s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test945850386/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/fix-inconclusive (7.85s) git_test_util.go:36: failed to start /usr/bin/git [git commit -m syz-bisect-test799140320-branch1-1]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-does-not-repro (7.85s) git_test_util.go:73: failed to start /usr/bin/git [git log --format=%H%n%s%n%ae%n%an%n%ad%n%P%n%cd%n%b -n 1 HEAD]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-finds-cause-baseline-repro (7.85s) git_test_util.go:73: failed to start /usr/bin/git [git log --format=%H%n%s%n%ae%n%an%n%ad%n%P%n%cd%n%b -n 1 HEAD]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/fix-does-not-repro (7.87s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test226302759/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-finds-cause-minimize-succeeds (7.86s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test159017397/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-same-binary (7.83s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test237309887/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/config-minimize-same-hash (7.93s) git_test_util.go:36: failed to start /usr/bin/git [git add /tmp/syz-bisect-test762310124/file]: fork/exec /usr/bin/git: resource temporarily unavailable --- FAIL: TestBisectionResults/group/cause-same-binary-release2 (7.93s) git_test_util.go:36: failed to start /usr/bin/git [git commit -m syz-bisect-test017845758-branch1-1]: fork/exec /usr/bin/git: resource temporarily unavailable FAIL FAIL github.com/google/syzkaller/pkg/bisect 14.562s ok github.com/google/syzkaller/pkg/build 17.089s ? github.com/google/syzkaller/pkg/cmdprof [no test files] ok github.com/google/syzkaller/pkg/compiler 8.618s ok github.com/google/syzkaller/pkg/config (cached) ok github.com/google/syzkaller/pkg/cover 5.729s --- FAIL: TestSysTests (7.07s) --- FAIL: TestSysTests/linux/riscv64 (1.92s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_scan: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_riscv64 -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_nanosleep -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_80211_inject_frame -D__NR_syz_80211_inject_frame -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/linux/arm (1.93s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_scan: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_arm -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_nanosleep -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_80211_inject_frame -D__NR_syz_80211_inject_frame -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/linux/mips64le (1.93s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_setup_ap: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_mips64le -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/test/64 (1.93s) csource_test.go:167: failed to generate C source for ../../sys/test/test/bf: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_64 -DGOOS_test -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_mmap]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/test/32_shmem (1.93s) csource_test.go:167: failed to generate C source for ../../sys/test/test/bf: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_32_shmem -DGOOS_test -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_mmap]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/linux/s390x (1.93s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_setup_ap: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_s390x -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/linux/386 (1.93s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_setup_ap: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_386 -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/linux/amd64 (1.93s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_setup_ap: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_amd64 -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/linux/arm64 (1.93s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_scan: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_arm64 -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_nanosleep -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_80211_inject_frame -D__NR_syz_80211_inject_frame -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/linux/ppc64le (1.93s) csource_test.go:167: failed to generate C source for ../../sys/linux/test/80211_scan: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_ppc64le -DGOOS_linux -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_ioctl -D__NR_mmap -D__NR_mmap -D__NR_mmap -D__NR_nanosleep -D__NR_sendmsg -D__NR_sendmsg -D__NR_socket -D__NR_syz_80211_inject_frame -D__NR_syz_80211_inject_frame -D__NR_syz_genetlink_get_family_id]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/test/64_fork (1.93s) csource_test.go:167: failed to generate C source for ../../sys/test/test/bf: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_64_fork -DGOOS_test -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_mmap]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/fuchsia/arm64 (1.93s) csource_test.go:167: failed to generate C source for ../../sys/fuchsia/test/pipe: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_arm64 -DGOOS_fuchsia -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_TMP_DIR -D__NR_close -D__NR_close -D__NR_pipe -D__NR_syz_mmap]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/fuchsia/amd64 (1.93s) csource_test.go:167: failed to generate C source for ../../sys/fuchsia/test/pipe: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_amd64 -DGOOS_fuchsia -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_TMP_DIR -D__NR_close -D__NR_close -D__NR_pipe -D__NR_syz_mmap]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestSysTests/test/32_fork_shmem (2.16s) csource_test.go:167: failed to generate C source for ../../sys/test/test/bf2: cpp failed: /usr/bin/cpp [cpp -nostdinc -undef -fdirectives-only -dDI -E -P - -DGOARCH_32_fork_shmem -DGOOS_test -DHOSTGOOS_linux -DSYZ_COLLIDE -DSYZ_EXECUTOR_USES_FORK_SERVER -DSYZ_EXECUTOR_USES_SHMEM -DSYZ_MULTI_PROC -DSYZ_REPEAT -DSYZ_REPRO -DSYZ_SANDBOX_NONE -DSYZ_THREADED -DSYZ_USE_BITMASKS -DSYZ_USE_TMP_DIR -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_compare -D__NR_syz_mmap]: fork/exec /usr/bin/cpp: resource temporarily unavailable --- FAIL: TestGenerate (7.08s) --- FAIL: TestGenerate/test/32_fork_shmem (0.15s) csource_test.go:67: seed=1603096744403087574 --- FAIL: TestGenerate/test/32_fork_shmem/1 (1.74s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: test$csum_ipv6_icmp(&(0x7f0000000000)={{"0003c9fb103f944285af6bd6b1d2d285", "f795a6c7d74af73790513134a2a4da33"}, {0x0, "4ff2d0d3de8605cd783bcb2d9b6602cd32ba970b3a6940b92d0eb5d7a2ca93c745f8151ee14ffd206fe36a2ac641c1efc44ea2470ecdca10eb3aa0eb31aba343fa87904b842e1f6d59d17ef37361e5a2cce750a06300aae7d8a8a832cb91196d2940a38fee470229517756c0ee0b7328ce107577a278bd4483fd7259497b4b8e6deaa4d049391297ec0ab776144ba9b7d9b4f0e43de0527ae5b16efbec71fe8219d34d4a5f8b431e3467ba9a2b308c91572dbf5dcf02eccbc7eab77ef6b2b96f3f2449dd2b869e3ec04e67"}}) foo$fmt4(&(0x7f0000000100)) foo$fmt0(&(0x7f0000000140)=0x9) mutate_array2(&(0x7f0000000180)=[{0x5}, {0xfe}]) test$length21(&(0x7f00000001c0)=0x53f4, 0x40) test$hint_data(&(0x7f0000000200)="e30e7deeda0a65eb519677cf24b25d43b4bfbe35667c33d1aecdbaff0f84318309a6f446b745348f7d541b01984197aafa0ce924687fd609420f0705c8563de2e86f41348778e045a4b0137584ba10653be5fcad1122807776e5e3f571967c9df593d27a95dc4f6ee1dc75b95d13b237dfe3f165812f28c3530b2404f2977bcfee834db02336f4f5c968417d11b4563fea1882a0693c475da6a44f1cbcaf9c1f105783") test_length15(0x5, 0x2) mutate_integer2(0x1, 0x7, 0x100, 0x3, 0x7) test$length25(&(0x7f00000002c0)=["c6578d6248c89125ed1b60a204647b0d09a01814cca5181f20ff878f0121e7e314a14bea6e26eb7e24a0bb49b88db47020b617fa17d2720eb848d5687aca427d4fba374c0f344936f4f350ab576134a78c465fc3f4179c65d2a99aca52f2ed3a5e781e8189a586ef65e80303070d5e4798aec408fa63fcc15cb9aee5b8d89adc83284966d7db4f4f2b3ddb4064a7b85cb53f6e16c8fd04f35355fceab16ead62a9395c95a0ad50745ba84b1d2ee66cc989daa977b8ab7a4546a5a20945", "01a6952f453c7471d83b04963251684b55417195bbc69af1cd93e2d5c3bc768d2e9092723c26c369a5b1a77b341384233daab7037e0f3227a6070f148de36e5652bb6887b92be7c1459c5a9d4a56f24352160fd2d9f1b5b335f63654733af16e33831eecc1cca55908045ddfd909e7d356df0012496d88f939c9842bfe67ecf56f0a4ce6a38c6e00316c874bc13441b5f9fb466df0bb4e5993142079efe917b09b1d8b78c08d3f78af1cf63efe49e83721d7e7b0003637034b79bfb488596eb0ff6e4e6b919a2c4968e994b1989087e33dc091a538", "413aa1c1b4ab651704fc1175fda37d4530d5a12010fbf9369f306b4f2ea34ce5e2dff2afc34cb5707d16c396c4cddf3782838755aca8d19cb1b7ea15d764ccb555b77deb170cb60c79b090266d43cde81a684378c5cb3453f22b232365edd20312d7868e1c349126375b1c8da969ff3e5aeafa133419807bea25413fb537dd62dbb60f049c1b5b0a48833c2e9272422dfd10dc9a857130e98d8d44daa1e24420b69d838d898b549f5ebfc944a21c3070001b06543e48dd64e76feb504eff545d93b857f999ba0714fe7b5089a8b5b84c7346ae74c37e536424b93c359f4466a55f", "a385401f31cb4cc322d11f2622b627ec35086d160eded1b5854983630c3b01b1befc2b62d20432f8f7ddb56d8a18352ef26c0c0d99be91427039f1bb19aa037f3ceb62eee770fea88ad1b848d3d547c7f5b2cb5a13b715c5879ebe31dcf9df3d363b65806c7834e0337cae3f1b0480f4592c7bb36f692feffe3d3640d1dc6dbe40627739e2b69c657fb9059a22776e7fd2ab4b1bfdefc035c60561157a83a18f9c1c798d567d90bb7084f2ac4f3b16"], 0x4) test$length20(&(0x7f0000000600)={{{0x4, 0x4, 0x7, 0x9}, 0x7, 0x7, 0x9}, 0x9, 0x9}) syz_compare(&(0x7f0000000000)='\x00', 0x1, &(0x7f0000000040)=@arr16be=[0x1, 0xfff, 0x6e, 0x1, 0x4, 0x1, 0x8001], 0xe) syz_compare_int$2(0x2, 0x3f, 0x7) syz_errno(0x2) syz_execute_func(&(0x7f0000000080)="a32f13f544efac4b66158b2262996b6b82697c03e8fd6fc298a7d828f76be9bfad63f68f7c8f27f388ab4cd56b3fa7205b7f") syz_exit(0x7ff) syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_sleep_ms(0x1f) csource_test.go:124: 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 static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } 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[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } 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 { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static long syz_mmap(volatile long a0, volatile long a1) { return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); } static long syz_errno(volatile long v) { errno = v; return v == 0 ? 0 : -1; } static long syz_exit(volatile long status) { _exit(status); return 0; } static long syz_sleep_ms(volatile long ms) { sleep_ms(ms); return 0; } static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { errno = EBADF; goto error; } if (memcmp((void*)want, (void*)got, want_len)) { errno = EINVAL; goto error; } return 0; error: return -1; } static long syz_compare_int(volatile long n, ...) { va_list args; va_start(args, n); long v0 = va_arg(args, long); long v1 = va_arg(args, long); long v2 = va_arg(args, long); long v3 = va_arg(args, long); va_end(args); if (n < 2 || n > 4) return errno = E2BIG, -1; if (n <= 2 && v2 != 0) return errno = EFAULT, -1; if (n <= 3 && v3 != 0) return errno = EFAULT, -1; if (v0 != v1) return errno = EINVAL, -1; if (n > 2 && v0 != v2) return errno = EINVAL, -1; if (n > 3 && v0 != v3) return errno = EINVAL, -1; return 0; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } 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); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } #ifndef SYS_foo #define SYS_foo 0 #endif #ifndef SYS_mutate_array2 #define SYS_mutate_array2 0 #endif #ifndef SYS_mutate_integer2 #define SYS_mutate_integer2 0 #endif #ifndef SYS_test #define SYS_test 0 #endif #ifndef SYS_test_length15 #define SYS_test_length15 0 #endif void execute_call(int call) { switch (call) { case 0: memcpy((void*)0x20000000, "\x00\x03\xc9\xfb\x10\x3f\x94\x42\x85\xaf\x6b\xd6\xb1\xd2\xd2\x85", 16); memcpy((void*)0x20000010, "\xf7\x95\xa6\xc7\xd7\x4a\xf7\x37\x90\x51\x31\x34\xa2\xa4\xda\x33", 16); *(uint16_t*)0x20000020 = 0; memcpy((void*)0x20000022, "\x4f\xf2\xd0\xd3\xde\x86\x05\xcd\x78\x3b\xcb\x2d\x9b\x66\x02\xcd\x32\xba\x97\x0b\x3a\x69\x40\xb9\x2d\x0e\xb5\xd7\xa2\xca\x93\xc7\x45\xf8\x15\x1e\xe1\x4f\xfd\x20\x6f\xe3\x6a\x2a\xc6\x41\xc1\xef\xc4\x4e\xa2\x47\x0e\xcd\xca\x10\xeb\x3a\xa0\xeb\x31\xab\xa3\x43\xfa\x87\x90\x4b\x84\x2e\x1f\x6d\x59\xd1\x7e\xf3\x73\x61\xe5\xa2\xcc\xe7\x50\xa0\x63\x00\xaa\xe7\xd8\xa8\xa8\x32\xcb\x91\x19\x6d\x29\x40\xa3\x8f\xee\x47\x02\x29\x51\x77\x56\xc0\xee\x0b\x73\x28\xce\x10\x75\x77\xa2\x78\xbd\x44\x83\xfd\x72\x59\x49\x7b\x4b\x8e\x6d\xea\xa4\xd0\x49\x39\x12\x97\xec\x0a\xb7\x76\x14\x4b\xa9\xb7\xd9\xb4\xf0\xe4\x3d\xe0\x52\x7a\xe5\xb1\x6e\xfb\xec\x71\xfe\x82\x19\xd3\x4d\x4a\x5f\x8b\x43\x1e\x34\x67\xba\x9a\x2b\x30\x8c\x91\x57\x2d\xbf\x5d\xcf\x02\xec\xcb\xc7\xea\xb7\x7e\xf6\xb2\xb9\x6f\x3f\x24\x49\xdd\x2b\x86\x9e\x3e\xc0\x4e\x67", 203); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000000, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000010, 16); uint32_t csum_1_chunk_2 = 0xcd000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x3a000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000020, 205); *(uint16_t*)0x20000020 = csum_inet_digest(&csum_1); syscall(SYS_test, 0x20000000, 0, 0, 0, 0, 0); break; case 1: sprintf((char*)0x20000100, "%020llu", (long long)0); syscall(SYS_foo, 0x20000100, 0); break; case 2: sprintf((char*)0x20000140, "%020llu", (long long)9); syscall(SYS_foo, 0x20000140, 0); break; case 3: *(uint8_t*)0x20000180 = 5; *(uint8_t*)0x20000181 = 0xfe; syscall(SYS_mutate_array2, 0x20000180); break; case 4: *(uint64_t*)0x200001c0 = 0x53f4; syscall(SYS_test, 0x200001c0, 0x40, 0, 0, 0, 0); break; case 5: memcpy((void*)0x20000200, "\xe3\x0e\x7d\xee\xda\x0a\x65\xeb\x51\x96\x77\xcf\x24\xb2\x5d\x43\xb4\xbf\xbe\x35\x66\x7c\x33\xd1\xae\xcd\xba\xff\x0f\x84\x31\x83\x09\xa6\xf4\x46\xb7\x45\x34\x8f\x7d\x54\x1b\x01\x98\x41\x97\xaa\xfa\x0c\xe9\x24\x68\x7f\xd6\x09\x42\x0f\x07\x05\xc8\x56\x3d\xe2\xe8\x6f\x41\x34\x87\x78\xe0\x45\xa4\xb0\x13\x75\x84\xba\x10\x65\x3b\xe5\xfc\xad\x11\x22\x80\x77\x76\xe5\xe3\xf5\x71\x96\x7c\x9d\xf5\x93\xd2\x7a\x95\xdc\x4f\x6e\xe1\xdc\x75\xb9\x5d\x13\xb2\x37\xdf\xe3\xf1\x65\x81\x2f\x28\xc3\x53\x0b\x24\x04\xf2\x97\x7b\xcf\xee\x83\x4d\xb0\x23\x36\xf4\xf5\xc9\x68\x41\x7d\x11\xb4\x56\x3f\xea\x18\x82\xa0\x69\x3c\x47\x5d\xa6\xa4\x4f\x1c\xbc\xaf\x9c\x1f\x10\x57\x83", 163); syscall(SYS_test, 0x20000200, 0, 0, 0, 0, 0); break; case 6: syscall(SYS_test_length15, 5, 2); break; case 7: syscall(SYS_mutate_integer2, 1ull, 7ull, 0x100, 3, 7); break; case 8: memcpy((void*)0x200002c0, "\xc6\x57\x8d\x62\x48\xc8\x91\x25\xed\x1b\x60\xa2\x04\x64\x7b\x0d\x09\xa0\x18\x14\xcc\xa5\x18\x1f\x20\xff\x87\x8f\x01\x21\xe7\xe3\x14\xa1\x4b\xea\x6e\x26\xeb\x7e\x24\xa0\xbb\x49\xb8\x8d\xb4\x70\x20\xb6\x17\xfa\x17\xd2\x72\x0e\xb8\x48\xd5\x68\x7a\xca\x42\x7d\x4f\xba\x37\x4c\x0f\x34\x49\x36\xf4\xf3\x50\xab\x57\x61\x34\xa7\x8c\x46\x5f\xc3\xf4\x17\x9c\x65\xd2\xa9\x9a\xca\x52\xf2\xed\x3a\x5e\x78\x1e\x81\x89\xa5\x86\xef\x65\xe8\x03\x03\x07\x0d\x5e\x47\x98\xae\xc4\x08\xfa\x63\xfc\xc1\x5c\xb9\xae\xe5\xb8\xd8\x9a\xdc\x83\x28\x49\x66\xd7\xdb\x4f\x4f\x2b\x3d\xdb\x40\x64\xa7\xb8\x5c\xb5\x3f\x6e\x16\xc8\xfd\x04\xf3\x53\x55\xfc\xea\xb1\x6e\xad\x62\xa9\x39\x5c\x95\xa0\xad\x50\x74\x5b\xa8\x4b\x1d\x2e\xe6\x6c\xc9\x89\xda\xa9\x77\xb8\xab\x7a\x45\x46\xa5\xa2\x09\x45", 189); memcpy((void*)0x2000037d, "\x01\xa6\x95\x2f\x45\x3c\x74\x71\xd8\x3b\x04\x96\x32\x51\x68\x4b\x55\x41\x71\x95\xbb\xc6\x9a\xf1\xcd\x93\xe2\xd5\xc3\xbc\x76\x8d\x2e\x90\x92\x72\x3c\x26\xc3\x69\xa5\xb1\xa7\x7b\x34\x13\x84\x23\x3d\xaa\xb7\x03\x7e\x0f\x32\x27\xa6\x07\x0f\x14\x8d\xe3\x6e\x56\x52\xbb\x68\x87\xb9\x2b\xe7\xc1\x45\x9c\x5a\x9d\x4a\x56\xf2\x43\x52\x16\x0f\xd2\xd9\xf1\xb5\xb3\x35\xf6\x36\x54\x73\x3a\xf1\x6e\x33\x83\x1e\xec\xc1\xcc\xa5\x59\x08\x04\x5d\xdf\xd9\x09\xe7\xd3\x56\xdf\x00\x12\x49\x6d\x88\xf9\x39\xc9\x84\x2b\xfe\x67\xec\xf5\x6f\x0a\x4c\xe6\xa3\x8c\x6e\x00\x31\x6c\x87\x4b\xc1\x34\x41\xb5\xf9\xfb\x46\x6d\xf0\xbb\x4e\x59\x93\x14\x20\x79\xef\xe9\x17\xb0\x9b\x1d\x8b\x78\xc0\x8d\x3f\x78\xaf\x1c\xf6\x3e\xfe\x49\xe8\x37\x21\xd7\xe7\xb0\x00\x36\x37\x03\x4b\x79\xbf\xb4\x88\x59\x6e\xb0\xff\x6e\x4e\x6b\x91\x9a\x2c\x49\x68\xe9\x94\xb1\x98\x90\x87\xe3\x3d\xc0\x91\xa5\x38", 213); memcpy((void*)0x20000452, "\x41\x3a\xa1\xc1\xb4\xab\x65\x17\x04\xfc\x11\x75\xfd\xa3\x7d\x45\x30\xd5\xa1\x20\x10\xfb\xf9\x36\x9f\x30\x6b\x4f\x2e\xa3\x4c\xe5\xe2\xdf\xf2\xaf\xc3\x4c\xb5\x70\x7d\x16\xc3\x96\xc4\xcd\xdf\x37\x82\x83\x87\x55\xac\xa8\xd1\x9c\xb1\xb7\xea\x15\xd7\x64\xcc\xb5\x55\xb7\x7d\xeb\x17\x0c\xb6\x0c\x79\xb0\x90\x26\x6d\x43\xcd\xe8\x1a\x68\x43\x78\xc5\xcb\x34\x53\xf2\x2b\x23\x23\x65\xed\xd2\x03\x12\xd7\x86\x8e\x1c\x34\x91\x26\x37\x5b\x1c\x8d\xa9\x69\xff\x3e\x5a\xea\xfa\x13\x34\x19\x80\x7b\xea\x25\x41\x3f\xb5\x37\xdd\x62\xdb\xb6\x0f\x04\x9c\x1b\x5b\x0a\x48\x83\x3c\x2e\x92\x72\x42\x2d\xfd\x10\xdc\x9a\x85\x71\x30\xe9\x8d\x8d\x44\xda\xa1\xe2\x44\x20\xb6\x9d\x83\x8d\x89\x8b\x54\x9f\x5e\xbf\xc9\x44\xa2\x1c\x30\x70\x00\x1b\x06\x54\x3e\x48\xdd\x64\xe7\x6f\xeb\x50\x4e\xff\x54\x5d\x93\xb8\x57\xf9\x99\xba\x07\x14\xfe\x7b\x50\x89\xa8\xb5\xb8\x4c\x73\x46\xae\x74\xc3\x7e\x53\x64\x24\xb9\x3c\x35\x9f\x44\x66\xa5\x5f", 225); memcpy((void*)0x20000533, "\xa3\x85\x40\x1f\x31\xcb\x4c\xc3\x22\xd1\x1f\x26\x22\xb6\x27\xec\x35\x08\x6d\x16\x0e\xde\xd1\xb5\x85\x49\x83\x63\x0c\x3b\x01\xb1\xbe\xfc\x2b\x62\xd2\x04\x32\xf8\xf7\xdd\xb5\x6d\x8a\x18\x35\x2e\xf2\x6c\x0c\x0d\x99\xbe\x91\x42\x70\x39\xf1\xbb\x19\xaa\x03\x7f\x3c\xeb\x62\xee\xe7\x70\xfe\xa8\x8a\xd1\xb8\x48\xd3\xd5\x47\xc7\xf5\xb2\xcb\x5a\x13\xb7\x15\xc5\x87\x9e\xbe\x31\xdc\xf9\xdf\x3d\x36\x3b\x65\x80\x6c\x78\x34\xe0\x33\x7c\xae\x3f\x1b\x04\x80\xf4\x59\x2c\x7b\xb3\x6f\x69\x2f\xef\xfe\x3d\x36\x40\xd1\xdc\x6d\xbe\x40\x62\x77\x39\xe2\xb6\x9c\x65\x7f\xb9\x05\x9a\x22\x77\x6e\x7f\xd2\xab\x4b\x1b\xfd\xef\xc0\x35\xc6\x05\x61\x15\x7a\x83\xa1\x8f\x9c\x1c\x79\x8d\x56\x7d\x90\xbb\x70\x84\xf2\xac\x4f\x3b\x16", 175); syscall(SYS_test, 0x200002c0, 4, 0, 0, 0, 0); break; case 9: *(uint8_t*)0x20000600 = 4; *(uint8_t*)0x20000601 = 4; *(uint8_t*)0x20000602 = 7; *(uint8_t*)0x20000603 = 9; *(uint8_t*)0x20000604 = 7; *(uint8_t*)0x20000605 = 7; *(uint8_t*)0x20000606 = 9; *(uint8_t*)0x20000607 = 9; *(uint8_t*)0x20000608 = 9; syscall(SYS_test, 0x20000600, 0, 0, 0, 0, 0); break; case 10: memcpy((void*)0x20000000, "\000", 1); *(uint16_t*)0x20000040 = htobe16(1); *(uint16_t*)0x20000042 = htobe16(0xfff); *(uint16_t*)0x20000044 = htobe16(0x6e); *(uint16_t*)0x20000046 = htobe16(1); *(uint16_t*)0x20000048 = htobe16(4); *(uint16_t*)0x2000004a = htobe16(1); *(uint16_t*)0x2000004c = htobe16(0x8001); syz_compare(0x20000000, 1, 0x20000040, 0xe); break; case 11: syz_compare_int(2, 0x3f, 7, 0, 0); break; case 12: syz_errno(2); break; case 13: memcpy((void*)0x20000080, "\xa3\x2f\x13\xf5\x44\xef\xac\x4b\x66\x15\x8b\x22\x62\x99\x6b\x6b\x82\x69\x7c\x03\xe8\xfd\x6f\xc2\x98\xa7\xd8\x28\xf7\x6b\xe9\xbf\xad\x63\xf6\x8f\x7c\x8f\x27\xf3\x88\xab\x4c\xd5\x6b\x3f\xa7\x20\x5b\x7f", 50); syz_execute_func(0x20000080); break; case 14: syz_exit(0x7ff); break; case 15: syz_mmap(0x20ffd000, 0x2000); break; case 16: syz_sleep_ms(0x1f); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); use_temporary_dir(); do_sandbox_none(); return 0; } compiler invocation: gcc [-o /tmp/syz-executor406345604 -DGOOS_test=1 -DGOARCH_32_fork_shmem=1 -DHOSTGOOS_linux=1 -x c - -m32 -static -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-overflow] --- FAIL: TestGenerate/test/32_fork_shmem/3 (1.74s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:false RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: test$csum_ipv6_icmp(&(0x7f0000000000)={{"0003c9fb103f944285af6bd6b1d2d285", "f795a6c7d74af73790513134a2a4da33"}, {0x0, "4ff2d0d3de8605cd783bcb2d9b6602cd32ba970b3a6940b92d0eb5d7a2ca93c745f8151ee14ffd206fe36a2ac641c1efc44ea2470ecdca10eb3aa0eb31aba343fa87904b842e1f6d59d17ef37361e5a2cce750a06300aae7d8a8a832cb91196d2940a38fee470229517756c0ee0b7328ce107577a278bd4483fd7259497b4b8e6deaa4d049391297ec0ab776144ba9b7d9b4f0e43de0527ae5b16efbec71fe8219d34d4a5f8b431e3467ba9a2b308c91572dbf5dcf02eccbc7eab77ef6b2b96f3f2449dd2b869e3ec04e67"}}) foo$fmt4(&(0x7f0000000100)) foo$fmt0(&(0x7f0000000140)=0x9) mutate_array2(&(0x7f0000000180)=[{0x5}, {0xfe}]) test$length21(&(0x7f00000001c0)=0x53f4, 0x40) test$hint_data(&(0x7f0000000200)="e30e7deeda0a65eb519677cf24b25d43b4bfbe35667c33d1aecdbaff0f84318309a6f446b745348f7d541b01984197aafa0ce924687fd609420f0705c8563de2e86f41348778e045a4b0137584ba10653be5fcad1122807776e5e3f571967c9df593d27a95dc4f6ee1dc75b95d13b237dfe3f165812f28c3530b2404f2977bcfee834db02336f4f5c968417d11b4563fea1882a0693c475da6a44f1cbcaf9c1f105783") test_length15(0x5, 0x2) mutate_integer2(0x1, 0x7, 0x100, 0x3, 0x7) test$length25(&(0x7f00000002c0)=["c6578d6248c89125ed1b60a204647b0d09a01814cca5181f20ff878f0121e7e314a14bea6e26eb7e24a0bb49b88db47020b617fa17d2720eb848d5687aca427d4fba374c0f344936f4f350ab576134a78c465fc3f4179c65d2a99aca52f2ed3a5e781e8189a586ef65e80303070d5e4798aec408fa63fcc15cb9aee5b8d89adc83284966d7db4f4f2b3ddb4064a7b85cb53f6e16c8fd04f35355fceab16ead62a9395c95a0ad50745ba84b1d2ee66cc989daa977b8ab7a4546a5a20945", "01a6952f453c7471d83b04963251684b55417195bbc69af1cd93e2d5c3bc768d2e9092723c26c369a5b1a77b341384233daab7037e0f3227a6070f148de36e5652bb6887b92be7c1459c5a9d4a56f24352160fd2d9f1b5b335f63654733af16e33831eecc1cca55908045ddfd909e7d356df0012496d88f939c9842bfe67ecf56f0a4ce6a38c6e00316c874bc13441b5f9fb466df0bb4e5993142079efe917b09b1d8b78c08d3f78af1cf63efe49e83721d7e7b0003637034b79bfb488596eb0ff6e4e6b919a2c4968e994b1989087e33dc091a538", "413aa1c1b4ab651704fc1175fda37d4530d5a12010fbf9369f306b4f2ea34ce5e2dff2afc34cb5707d16c396c4cddf3782838755aca8d19cb1b7ea15d764ccb555b77deb170cb60c79b090266d43cde81a684378c5cb3453f22b232365edd20312d7868e1c349126375b1c8da969ff3e5aeafa133419807bea25413fb537dd62dbb60f049c1b5b0a48833c2e9272422dfd10dc9a857130e98d8d44daa1e24420b69d838d898b549f5ebfc944a21c3070001b06543e48dd64e76feb504eff545d93b857f999ba0714fe7b5089a8b5b84c7346ae74c37e536424b93c359f4466a55f", "a385401f31cb4cc322d11f2622b627ec35086d160eded1b5854983630c3b01b1befc2b62d20432f8f7ddb56d8a18352ef26c0c0d99be91427039f1bb19aa037f3ceb62eee770fea88ad1b848d3d547c7f5b2cb5a13b715c5879ebe31dcf9df3d363b65806c7834e0337cae3f1b0480f4592c7bb36f692feffe3d3640d1dc6dbe40627739e2b69c657fb9059a22776e7fd2ab4b1bfdefc035c60561157a83a18f9c1c798d567d90bb7084f2ac4f3b16"], 0x4) test$length20(&(0x7f0000000600)={{{0x4, 0x4, 0x7, 0x9}, 0x7, 0x7, 0x9}, 0x9, 0x9}) syz_compare(&(0x7f0000000000)='\x00', 0x1, &(0x7f0000000040)=@arr16be=[0x1, 0xfff, 0x6e, 0x1, 0x4, 0x1, 0x8001], 0xe) syz_compare_int$2(0x2, 0x3f, 0x7) syz_errno(0x2) syz_execute_func(&(0x7f0000000080)="a32f13f544efac4b66158b2262996b6b82697c03e8fd6fc298a7d828f76be9bfad63f68f7c8f27f388ab4cd56b3fa7205b7f") syz_exit(0x7ff) syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_sleep_ms(0x1f) csource_test.go:124: 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 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[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } 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 { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static long syz_mmap(volatile long a0, volatile long a1) { return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); } static long syz_errno(volatile long v) { errno = v; return v == 0 ? 0 : -1; } static long syz_exit(volatile long status) { _exit(status); return 0; } static long syz_sleep_ms(volatile long ms) { sleep_ms(ms); return 0; } static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { errno = EBADF; goto error; } if (memcmp((void*)want, (void*)got, want_len)) { errno = EINVAL; goto error; } return 0; error: return -1; } static long syz_compare_int(volatile long n, ...) { va_list args; va_start(args, n); long v0 = va_arg(args, long); long v1 = va_arg(args, long); long v2 = va_arg(args, long); long v3 = va_arg(args, long); va_end(args); if (n < 2 || n > 4) return errno = E2BIG, -1; if (n <= 2 && v2 != 0) return errno = EFAULT, -1; if (n <= 3 && v3 != 0) return errno = EFAULT, -1; if (v0 != v1) return errno = EINVAL, -1; if (n > 2 && v0 != v2) return errno = EINVAL, -1; if (n > 3 && v0 != v3) return errno = EINVAL, -1; return 0; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } 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); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } #ifndef SYS_foo #define SYS_foo 0 #endif #ifndef SYS_mutate_array2 #define SYS_mutate_array2 0 #endif #ifndef SYS_mutate_integer2 #define SYS_mutate_integer2 0 #endif #ifndef SYS_test #define SYS_test 0 #endif #ifndef SYS_test_length15 #define SYS_test_length15 0 #endif void execute_call(int call) { switch (call) { case 0: memcpy((void*)0x20000000, "\x00\x03\xc9\xfb\x10\x3f\x94\x42\x85\xaf\x6b\xd6\xb1\xd2\xd2\x85", 16); memcpy((void*)0x20000010, "\xf7\x95\xa6\xc7\xd7\x4a\xf7\x37\x90\x51\x31\x34\xa2\xa4\xda\x33", 16); *(uint16_t*)0x20000020 = 0; memcpy((void*)0x20000022, "\x4f\xf2\xd0\xd3\xde\x86\x05\xcd\x78\x3b\xcb\x2d\x9b\x66\x02\xcd\x32\xba\x97\x0b\x3a\x69\x40\xb9\x2d\x0e\xb5\xd7\xa2\xca\x93\xc7\x45\xf8\x15\x1e\xe1\x4f\xfd\x20\x6f\xe3\x6a\x2a\xc6\x41\xc1\xef\xc4\x4e\xa2\x47\x0e\xcd\xca\x10\xeb\x3a\xa0\xeb\x31\xab\xa3\x43\xfa\x87\x90\x4b\x84\x2e\x1f\x6d\x59\xd1\x7e\xf3\x73\x61\xe5\xa2\xcc\xe7\x50\xa0\x63\x00\xaa\xe7\xd8\xa8\xa8\x32\xcb\x91\x19\x6d\x29\x40\xa3\x8f\xee\x47\x02\x29\x51\x77\x56\xc0\xee\x0b\x73\x28\xce\x10\x75\x77\xa2\x78\xbd\x44\x83\xfd\x72\x59\x49\x7b\x4b\x8e\x6d\xea\xa4\xd0\x49\x39\x12\x97\xec\x0a\xb7\x76\x14\x4b\xa9\xb7\xd9\xb4\xf0\xe4\x3d\xe0\x52\x7a\xe5\xb1\x6e\xfb\xec\x71\xfe\x82\x19\xd3\x4d\x4a\x5f\x8b\x43\x1e\x34\x67\xba\x9a\x2b\x30\x8c\x91\x57\x2d\xbf\x5d\xcf\x02\xec\xcb\xc7\xea\xb7\x7e\xf6\xb2\xb9\x6f\x3f\x24\x49\xdd\x2b\x86\x9e\x3e\xc0\x4e\x67", 203); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000000, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000010, 16); uint32_t csum_1_chunk_2 = 0xcd000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x3a000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000020, 205); *(uint16_t*)0x20000020 = csum_inet_digest(&csum_1); syscall(SYS_test, 0x20000000, 0, 0, 0, 0, 0); break; case 1: sprintf((char*)0x20000100, "%020llu", (long long)0); syscall(SYS_foo, 0x20000100, 0); break; case 2: sprintf((char*)0x20000140, "%020llu", (long long)9); syscall(SYS_foo, 0x20000140, 0); break; case 3: *(uint8_t*)0x20000180 = 5; *(uint8_t*)0x20000181 = 0xfe; syscall(SYS_mutate_array2, 0x20000180); break; case 4: *(uint64_t*)0x200001c0 = 0x53f4; syscall(SYS_test, 0x200001c0, 0x40, 0, 0, 0, 0); break; case 5: memcpy((void*)0x20000200, "\xe3\x0e\x7d\xee\xda\x0a\x65\xeb\x51\x96\x77\xcf\x24\xb2\x5d\x43\xb4\xbf\xbe\x35\x66\x7c\x33\xd1\xae\xcd\xba\xff\x0f\x84\x31\x83\x09\xa6\xf4\x46\xb7\x45\x34\x8f\x7d\x54\x1b\x01\x98\x41\x97\xaa\xfa\x0c\xe9\x24\x68\x7f\xd6\x09\x42\x0f\x07\x05\xc8\x56\x3d\xe2\xe8\x6f\x41\x34\x87\x78\xe0\x45\xa4\xb0\x13\x75\x84\xba\x10\x65\x3b\xe5\xfc\xad\x11\x22\x80\x77\x76\xe5\xe3\xf5\x71\x96\x7c\x9d\xf5\x93\xd2\x7a\x95\xdc\x4f\x6e\xe1\xdc\x75\xb9\x5d\x13\xb2\x37\xdf\xe3\xf1\x65\x81\x2f\x28\xc3\x53\x0b\x24\x04\xf2\x97\x7b\xcf\xee\x83\x4d\xb0\x23\x36\xf4\xf5\xc9\x68\x41\x7d\x11\xb4\x56\x3f\xea\x18\x82\xa0\x69\x3c\x47\x5d\xa6\xa4\x4f\x1c\xbc\xaf\x9c\x1f\x10\x57\x83", 163); syscall(SYS_test, 0x20000200, 0, 0, 0, 0, 0); break; case 6: syscall(SYS_test_length15, 5, 2); break; case 7: syscall(SYS_mutate_integer2, 1ull, 7ull, 0x100, 3, 7); break; case 8: memcpy((void*)0x200002c0, "\xc6\x57\x8d\x62\x48\xc8\x91\x25\xed\x1b\x60\xa2\x04\x64\x7b\x0d\x09\xa0\x18\x14\xcc\xa5\x18\x1f\x20\xff\x87\x8f\x01\x21\xe7\xe3\x14\xa1\x4b\xea\x6e\x26\xeb\x7e\x24\xa0\xbb\x49\xb8\x8d\xb4\x70\x20\xb6\x17\xfa\x17\xd2\x72\x0e\xb8\x48\xd5\x68\x7a\xca\x42\x7d\x4f\xba\x37\x4c\x0f\x34\x49\x36\xf4\xf3\x50\xab\x57\x61\x34\xa7\x8c\x46\x5f\xc3\xf4\x17\x9c\x65\xd2\xa9\x9a\xca\x52\xf2\xed\x3a\x5e\x78\x1e\x81\x89\xa5\x86\xef\x65\xe8\x03\x03\x07\x0d\x5e\x47\x98\xae\xc4\x08\xfa\x63\xfc\xc1\x5c\xb9\xae\xe5\xb8\xd8\x9a\xdc\x83\x28\x49\x66\xd7\xdb\x4f\x4f\x2b\x3d\xdb\x40\x64\xa7\xb8\x5c\xb5\x3f\x6e\x16\xc8\xfd\x04\xf3\x53\x55\xfc\xea\xb1\x6e\xad\x62\xa9\x39\x5c\x95\xa0\xad\x50\x74\x5b\xa8\x4b\x1d\x2e\xe6\x6c\xc9\x89\xda\xa9\x77\xb8\xab\x7a\x45\x46\xa5\xa2\x09\x45", 189); memcpy((void*)0x2000037d, "\x01\xa6\x95\x2f\x45\x3c\x74\x71\xd8\x3b\x04\x96\x32\x51\x68\x4b\x55\x41\x71\x95\xbb\xc6\x9a\xf1\xcd\x93\xe2\xd5\xc3\xbc\x76\x8d\x2e\x90\x92\x72\x3c\x26\xc3\x69\xa5\xb1\xa7\x7b\x34\x13\x84\x23\x3d\xaa\xb7\x03\x7e\x0f\x32\x27\xa6\x07\x0f\x14\x8d\xe3\x6e\x56\x52\xbb\x68\x87\xb9\x2b\xe7\xc1\x45\x9c\x5a\x9d\x4a\x56\xf2\x43\x52\x16\x0f\xd2\xd9\xf1\xb5\xb3\x35\xf6\x36\x54\x73\x3a\xf1\x6e\x33\x83\x1e\xec\xc1\xcc\xa5\x59\x08\x04\x5d\xdf\xd9\x09\xe7\xd3\x56\xdf\x00\x12\x49\x6d\x88\xf9\x39\xc9\x84\x2b\xfe\x67\xec\xf5\x6f\x0a\x4c\xe6\xa3\x8c\x6e\x00\x31\x6c\x87\x4b\xc1\x34\x41\xb5\xf9\xfb\x46\x6d\xf0\xbb\x4e\x59\x93\x14\x20\x79\xef\xe9\x17\xb0\x9b\x1d\x8b\x78\xc0\x8d\x3f\x78\xaf\x1c\xf6\x3e\xfe\x49\xe8\x37\x21\xd7\xe7\xb0\x00\x36\x37\x03\x4b\x79\xbf\xb4\x88\x59\x6e\xb0\xff\x6e\x4e\x6b\x91\x9a\x2c\x49\x68\xe9\x94\xb1\x98\x90\x87\xe3\x3d\xc0\x91\xa5\x38", 213); memcpy((void*)0x20000452, "\x41\x3a\xa1\xc1\xb4\xab\x65\x17\x04\xfc\x11\x75\xfd\xa3\x7d\x45\x30\xd5\xa1\x20\x10\xfb\xf9\x36\x9f\x30\x6b\x4f\x2e\xa3\x4c\xe5\xe2\xdf\xf2\xaf\xc3\x4c\xb5\x70\x7d\x16\xc3\x96\xc4\xcd\xdf\x37\x82\x83\x87\x55\xac\xa8\xd1\x9c\xb1\xb7\xea\x15\xd7\x64\xcc\xb5\x55\xb7\x7d\xeb\x17\x0c\xb6\x0c\x79\xb0\x90\x26\x6d\x43\xcd\xe8\x1a\x68\x43\x78\xc5\xcb\x34\x53\xf2\x2b\x23\x23\x65\xed\xd2\x03\x12\xd7\x86\x8e\x1c\x34\x91\x26\x37\x5b\x1c\x8d\xa9\x69\xff\x3e\x5a\xea\xfa\x13\x34\x19\x80\x7b\xea\x25\x41\x3f\xb5\x37\xdd\x62\xdb\xb6\x0f\x04\x9c\x1b\x5b\x0a\x48\x83\x3c\x2e\x92\x72\x42\x2d\xfd\x10\xdc\x9a\x85\x71\x30\xe9\x8d\x8d\x44\xda\xa1\xe2\x44\x20\xb6\x9d\x83\x8d\x89\x8b\x54\x9f\x5e\xbf\xc9\x44\xa2\x1c\x30\x70\x00\x1b\x06\x54\x3e\x48\xdd\x64\xe7\x6f\xeb\x50\x4e\xff\x54\x5d\x93\xb8\x57\xf9\x99\xba\x07\x14\xfe\x7b\x50\x89\xa8\xb5\xb8\x4c\x73\x46\xae\x74\xc3\x7e\x53\x64\x24\xb9\x3c\x35\x9f\x44\x66\xa5\x5f", 225); memcpy((void*)0x20000533, "\xa3\x85\x40\x1f\x31\xcb\x4c\xc3\x22\xd1\x1f\x26\x22\xb6\x27\xec\x35\x08\x6d\x16\x0e\xde\xd1\xb5\x85\x49\x83\x63\x0c\x3b\x01\xb1\xbe\xfc\x2b\x62\xd2\x04\x32\xf8\xf7\xdd\xb5\x6d\x8a\x18\x35\x2e\xf2\x6c\x0c\x0d\x99\xbe\x91\x42\x70\x39\xf1\xbb\x19\xaa\x03\x7f\x3c\xeb\x62\xee\xe7\x70\xfe\xa8\x8a\xd1\xb8\x48\xd3\xd5\x47\xc7\xf5\xb2\xcb\x5a\x13\xb7\x15\xc5\x87\x9e\xbe\x31\xdc\xf9\xdf\x3d\x36\x3b\x65\x80\x6c\x78\x34\xe0\x33\x7c\xae\x3f\x1b\x04\x80\xf4\x59\x2c\x7b\xb3\x6f\x69\x2f\xef\xfe\x3d\x36\x40\xd1\xdc\x6d\xbe\x40\x62\x77\x39\xe2\xb6\x9c\x65\x7f\xb9\x05\x9a\x22\x77\x6e\x7f\xd2\xab\x4b\x1b\xfd\xef\xc0\x35\xc6\x05\x61\x15\x7a\x83\xa1\x8f\x9c\x1c\x79\x8d\x56\x7d\x90\xbb\x70\x84\xf2\xac\x4f\x3b\x16", 175); syscall(SYS_test, 0x200002c0, 4, 0, 0, 0, 0); break; case 9: *(uint8_t*)0x20000600 = 4; *(uint8_t*)0x20000601 = 4; *(uint8_t*)0x20000602 = 7; *(uint8_t*)0x20000603 = 9; *(uint8_t*)0x20000604 = 7; *(uint8_t*)0x20000605 = 7; *(uint8_t*)0x20000606 = 9; *(uint8_t*)0x20000607 = 9; *(uint8_t*)0x20000608 = 9; syscall(SYS_test, 0x20000600, 0, 0, 0, 0, 0); break; case 10: memcpy((void*)0x20000000, "\000", 1); *(uint16_t*)0x20000040 = htobe16(1); *(uint16_t*)0x20000042 = htobe16(0xfff); *(uint16_t*)0x20000044 = htobe16(0x6e); *(uint16_t*)0x20000046 = htobe16(1); *(uint16_t*)0x20000048 = htobe16(4); *(uint16_t*)0x2000004a = htobe16(1); *(uint16_t*)0x2000004c = htobe16(0x8001); syz_compare(0x20000000, 1, 0x20000040, 0xe); break; case 11: syz_compare_int(2, 0x3f, 7, 0, 0); break; case 12: syz_errno(2); break; case 13: memcpy((void*)0x20000080, "\xa3\x2f\x13\xf5\x44\xef\xac\x4b\x66\x15\x8b\x22\x62\x99\x6b\x6b\x82\x69\x7c\x03\xe8\xfd\x6f\xc2\x98\xa7\xd8\x28\xf7\x6b\xe9\xbf\xad\x63\xf6\x8f\x7c\x8f\x27\xf3\x88\xab\x4c\xd5\x6b\x3f\xa7\x20\x5b\x7f", 50); syz_execute_func(0x20000080); break; case 14: syz_exit(0x7ff); break; case 15: syz_mmap(0x20ffd000, 0x2000); break; case 16: syz_sleep_ms(0x1f); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); use_temporary_dir(); do_sandbox_none(); return 0; } compiler invocation: gcc [-o /tmp/syz-executor189162771 -DGOOS_test=1 -DGOARCH_32_fork_shmem=1 -DHOSTGOOS_linux=1 -x c - -m32 -static -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-overflow] --- FAIL: TestGenerate/test/32_fork_shmem/6 (1.75s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:4 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: test$csum_ipv6_icmp(&(0x7f0000000000)={{"0003c9fb103f944285af6bd6b1d2d285", "f795a6c7d74af73790513134a2a4da33"}, {0x0, "4ff2d0d3de8605cd783bcb2d9b6602cd32ba970b3a6940b92d0eb5d7a2ca93c745f8151ee14ffd206fe36a2ac641c1efc44ea2470ecdca10eb3aa0eb31aba343fa87904b842e1f6d59d17ef37361e5a2cce750a06300aae7d8a8a832cb91196d2940a38fee470229517756c0ee0b7328ce107577a278bd4483fd7259497b4b8e6deaa4d049391297ec0ab776144ba9b7d9b4f0e43de0527ae5b16efbec71fe8219d34d4a5f8b431e3467ba9a2b308c91572dbf5dcf02eccbc7eab77ef6b2b96f3f2449dd2b869e3ec04e67"}}) foo$fmt4(&(0x7f0000000100)) foo$fmt0(&(0x7f0000000140)=0x9) mutate_array2(&(0x7f0000000180)=[{0x5}, {0xfe}]) test$length21(&(0x7f00000001c0)=0x53f4, 0x40) test$hint_data(&(0x7f0000000200)="e30e7deeda0a65eb519677cf24b25d43b4bfbe35667c33d1aecdbaff0f84318309a6f446b745348f7d541b01984197aafa0ce924687fd609420f0705c8563de2e86f41348778e045a4b0137584ba10653be5fcad1122807776e5e3f571967c9df593d27a95dc4f6ee1dc75b95d13b237dfe3f165812f28c3530b2404f2977bcfee834db02336f4f5c968417d11b4563fea1882a0693c475da6a44f1cbcaf9c1f105783") test_length15(0x5, 0x2) mutate_integer2(0x1, 0x7, 0x100, 0x3, 0x7) test$length25(&(0x7f00000002c0)=["c6578d6248c89125ed1b60a204647b0d09a01814cca5181f20ff878f0121e7e314a14bea6e26eb7e24a0bb49b88db47020b617fa17d2720eb848d5687aca427d4fba374c0f344936f4f350ab576134a78c465fc3f4179c65d2a99aca52f2ed3a5e781e8189a586ef65e80303070d5e4798aec408fa63fcc15cb9aee5b8d89adc83284966d7db4f4f2b3ddb4064a7b85cb53f6e16c8fd04f35355fceab16ead62a9395c95a0ad50745ba84b1d2ee66cc989daa977b8ab7a4546a5a20945", "01a6952f453c7471d83b04963251684b55417195bbc69af1cd93e2d5c3bc768d2e9092723c26c369a5b1a77b341384233daab7037e0f3227a6070f148de36e5652bb6887b92be7c1459c5a9d4a56f24352160fd2d9f1b5b335f63654733af16e33831eecc1cca55908045ddfd909e7d356df0012496d88f939c9842bfe67ecf56f0a4ce6a38c6e00316c874bc13441b5f9fb466df0bb4e5993142079efe917b09b1d8b78c08d3f78af1cf63efe49e83721d7e7b0003637034b79bfb488596eb0ff6e4e6b919a2c4968e994b1989087e33dc091a538", "413aa1c1b4ab651704fc1175fda37d4530d5a12010fbf9369f306b4f2ea34ce5e2dff2afc34cb5707d16c396c4cddf3782838755aca8d19cb1b7ea15d764ccb555b77deb170cb60c79b090266d43cde81a684378c5cb3453f22b232365edd20312d7868e1c349126375b1c8da969ff3e5aeafa133419807bea25413fb537dd62dbb60f049c1b5b0a48833c2e9272422dfd10dc9a857130e98d8d44daa1e24420b69d838d898b549f5ebfc944a21c3070001b06543e48dd64e76feb504eff545d93b857f999ba0714fe7b5089a8b5b84c7346ae74c37e536424b93c359f4466a55f", "a385401f31cb4cc322d11f2622b627ec35086d160eded1b5854983630c3b01b1befc2b62d20432f8f7ddb56d8a18352ef26c0c0d99be91427039f1bb19aa037f3ceb62eee770fea88ad1b848d3d547c7f5b2cb5a13b715c5879ebe31dcf9df3d363b65806c7834e0337cae3f1b0480f4592c7bb36f692feffe3d3640d1dc6dbe40627739e2b69c657fb9059a22776e7fd2ab4b1bfdefc035c60561157a83a18f9c1c798d567d90bb7084f2ac4f3b16"], 0x4) test$length20(&(0x7f0000000600)={{{0x4, 0x4, 0x7, 0x9}, 0x7, 0x7, 0x9}, 0x9, 0x9}) syz_compare(&(0x7f0000000000)='\x00', 0x1, &(0x7f0000000040)=@arr16be=[0x1, 0xfff, 0x6e, 0x1, 0x4, 0x1, 0x8001], 0xe) syz_compare_int$2(0x2, 0x3f, 0x7) syz_errno(0x2) syz_execute_func(&(0x7f0000000080)="a32f13f544efac4b66158b2262996b6b82697c03e8fd6fc298a7d828f76be9bfad63f68f7c8f27f388ab4cd56b3fa7205b7f") syz_exit(0x7ff) syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_sleep_ms(0x1f) csource_test.go:124: 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 static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } 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[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } 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 { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static long syz_mmap(volatile long a0, volatile long a1) { return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); } static long syz_errno(volatile long v) { errno = v; return v == 0 ? 0 : -1; } static long syz_exit(volatile long status) { _exit(status); return 0; } static long syz_sleep_ms(volatile long ms) { sleep_ms(ms); return 0; } static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { errno = EBADF; goto error; } if (memcmp((void*)want, (void*)got, want_len)) { errno = EINVAL; goto error; } return 0; error: return -1; } static long syz_compare_int(volatile long n, ...) { va_list args; va_start(args, n); long v0 = va_arg(args, long); long v1 = va_arg(args, long); long v2 = va_arg(args, long); long v3 = va_arg(args, long); va_end(args); if (n < 2 || n > 4) return errno = E2BIG, -1; if (n <= 2 && v2 != 0) return errno = EFAULT, -1; if (n <= 3 && v3 != 0) return errno = EFAULT, -1; if (v0 != v1) return errno = EINVAL, -1; if (n > 2 && v0 != v2) return errno = EINVAL, -1; if (n > 3 && v0 != v3) return errno = EINVAL, -1; return 0; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } 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); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } #ifndef SYS_foo #define SYS_foo 0 #endif #ifndef SYS_mutate_array2 #define SYS_mutate_array2 0 #endif #ifndef SYS_mutate_integer2 #define SYS_mutate_integer2 0 #endif #ifndef SYS_test #define SYS_test 0 #endif #ifndef SYS_test_length15 #define SYS_test_length15 0 #endif void execute_call(int call) { switch (call) { case 0: memcpy((void*)0x20000000, "\x00\x03\xc9\xfb\x10\x3f\x94\x42\x85\xaf\x6b\xd6\xb1\xd2\xd2\x85", 16); memcpy((void*)0x20000010, "\xf7\x95\xa6\xc7\xd7\x4a\xf7\x37\x90\x51\x31\x34\xa2\xa4\xda\x33", 16); *(uint16_t*)0x20000020 = 0; memcpy((void*)0x20000022, "\x4f\xf2\xd0\xd3\xde\x86\x05\xcd\x78\x3b\xcb\x2d\x9b\x66\x02\xcd\x32\xba\x97\x0b\x3a\x69\x40\xb9\x2d\x0e\xb5\xd7\xa2\xca\x93\xc7\x45\xf8\x15\x1e\xe1\x4f\xfd\x20\x6f\xe3\x6a\x2a\xc6\x41\xc1\xef\xc4\x4e\xa2\x47\x0e\xcd\xca\x10\xeb\x3a\xa0\xeb\x31\xab\xa3\x43\xfa\x87\x90\x4b\x84\x2e\x1f\x6d\x59\xd1\x7e\xf3\x73\x61\xe5\xa2\xcc\xe7\x50\xa0\x63\x00\xaa\xe7\xd8\xa8\xa8\x32\xcb\x91\x19\x6d\x29\x40\xa3\x8f\xee\x47\x02\x29\x51\x77\x56\xc0\xee\x0b\x73\x28\xce\x10\x75\x77\xa2\x78\xbd\x44\x83\xfd\x72\x59\x49\x7b\x4b\x8e\x6d\xea\xa4\xd0\x49\x39\x12\x97\xec\x0a\xb7\x76\x14\x4b\xa9\xb7\xd9\xb4\xf0\xe4\x3d\xe0\x52\x7a\xe5\xb1\x6e\xfb\xec\x71\xfe\x82\x19\xd3\x4d\x4a\x5f\x8b\x43\x1e\x34\x67\xba\x9a\x2b\x30\x8c\x91\x57\x2d\xbf\x5d\xcf\x02\xec\xcb\xc7\xea\xb7\x7e\xf6\xb2\xb9\x6f\x3f\x24\x49\xdd\x2b\x86\x9e\x3e\xc0\x4e\x67", 203); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000000, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000010, 16); uint32_t csum_1_chunk_2 = 0xcd000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x3a000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000020, 205); *(uint16_t*)0x20000020 = csum_inet_digest(&csum_1); syscall(SYS_test, 0x20000000, 0, 0, 0, 0, 0); break; case 1: sprintf((char*)0x20000100, "%020llu", (long long)0); syscall(SYS_foo, 0x20000100, 0); break; case 2: sprintf((char*)0x20000140, "%020llu", (long long)9); syscall(SYS_foo, 0x20000140, 0); break; case 3: *(uint8_t*)0x20000180 = 5; *(uint8_t*)0x20000181 = 0xfe; syscall(SYS_mutate_array2, 0x20000180); break; case 4: *(uint64_t*)0x200001c0 = 0x53f4; syscall(SYS_test, 0x200001c0, 0x40, 0, 0, 0, 0); break; case 5: memcpy((void*)0x20000200, "\xe3\x0e\x7d\xee\xda\x0a\x65\xeb\x51\x96\x77\xcf\x24\xb2\x5d\x43\xb4\xbf\xbe\x35\x66\x7c\x33\xd1\xae\xcd\xba\xff\x0f\x84\x31\x83\x09\xa6\xf4\x46\xb7\x45\x34\x8f\x7d\x54\x1b\x01\x98\x41\x97\xaa\xfa\x0c\xe9\x24\x68\x7f\xd6\x09\x42\x0f\x07\x05\xc8\x56\x3d\xe2\xe8\x6f\x41\x34\x87\x78\xe0\x45\xa4\xb0\x13\x75\x84\xba\x10\x65\x3b\xe5\xfc\xad\x11\x22\x80\x77\x76\xe5\xe3\xf5\x71\x96\x7c\x9d\xf5\x93\xd2\x7a\x95\xdc\x4f\x6e\xe1\xdc\x75\xb9\x5d\x13\xb2\x37\xdf\xe3\xf1\x65\x81\x2f\x28\xc3\x53\x0b\x24\x04\xf2\x97\x7b\xcf\xee\x83\x4d\xb0\x23\x36\xf4\xf5\xc9\x68\x41\x7d\x11\xb4\x56\x3f\xea\x18\x82\xa0\x69\x3c\x47\x5d\xa6\xa4\x4f\x1c\xbc\xaf\x9c\x1f\x10\x57\x83", 163); syscall(SYS_test, 0x20000200, 0, 0, 0, 0, 0); break; case 6: syscall(SYS_test_length15, 5, 2); break; case 7: syscall(SYS_mutate_integer2, 1ull, 7ull, 0x100, 3, 7); break; case 8: memcpy((void*)0x200002c0, "\xc6\x57\x8d\x62\x48\xc8\x91\x25\xed\x1b\x60\xa2\x04\x64\x7b\x0d\x09\xa0\x18\x14\xcc\xa5\x18\x1f\x20\xff\x87\x8f\x01\x21\xe7\xe3\x14\xa1\x4b\xea\x6e\x26\xeb\x7e\x24\xa0\xbb\x49\xb8\x8d\xb4\x70\x20\xb6\x17\xfa\x17\xd2\x72\x0e\xb8\x48\xd5\x68\x7a\xca\x42\x7d\x4f\xba\x37\x4c\x0f\x34\x49\x36\xf4\xf3\x50\xab\x57\x61\x34\xa7\x8c\x46\x5f\xc3\xf4\x17\x9c\x65\xd2\xa9\x9a\xca\x52\xf2\xed\x3a\x5e\x78\x1e\x81\x89\xa5\x86\xef\x65\xe8\x03\x03\x07\x0d\x5e\x47\x98\xae\xc4\x08\xfa\x63\xfc\xc1\x5c\xb9\xae\xe5\xb8\xd8\x9a\xdc\x83\x28\x49\x66\xd7\xdb\x4f\x4f\x2b\x3d\xdb\x40\x64\xa7\xb8\x5c\xb5\x3f\x6e\x16\xc8\xfd\x04\xf3\x53\x55\xfc\xea\xb1\x6e\xad\x62\xa9\x39\x5c\x95\xa0\xad\x50\x74\x5b\xa8\x4b\x1d\x2e\xe6\x6c\xc9\x89\xda\xa9\x77\xb8\xab\x7a\x45\x46\xa5\xa2\x09\x45", 189); memcpy((void*)0x2000037d, "\x01\xa6\x95\x2f\x45\x3c\x74\x71\xd8\x3b\x04\x96\x32\x51\x68\x4b\x55\x41\x71\x95\xbb\xc6\x9a\xf1\xcd\x93\xe2\xd5\xc3\xbc\x76\x8d\x2e\x90\x92\x72\x3c\x26\xc3\x69\xa5\xb1\xa7\x7b\x34\x13\x84\x23\x3d\xaa\xb7\x03\x7e\x0f\x32\x27\xa6\x07\x0f\x14\x8d\xe3\x6e\x56\x52\xbb\x68\x87\xb9\x2b\xe7\xc1\x45\x9c\x5a\x9d\x4a\x56\xf2\x43\x52\x16\x0f\xd2\xd9\xf1\xb5\xb3\x35\xf6\x36\x54\x73\x3a\xf1\x6e\x33\x83\x1e\xec\xc1\xcc\xa5\x59\x08\x04\x5d\xdf\xd9\x09\xe7\xd3\x56\xdf\x00\x12\x49\x6d\x88\xf9\x39\xc9\x84\x2b\xfe\x67\xec\xf5\x6f\x0a\x4c\xe6\xa3\x8c\x6e\x00\x31\x6c\x87\x4b\xc1\x34\x41\xb5\xf9\xfb\x46\x6d\xf0\xbb\x4e\x59\x93\x14\x20\x79\xef\xe9\x17\xb0\x9b\x1d\x8b\x78\xc0\x8d\x3f\x78\xaf\x1c\xf6\x3e\xfe\x49\xe8\x37\x21\xd7\xe7\xb0\x00\x36\x37\x03\x4b\x79\xbf\xb4\x88\x59\x6e\xb0\xff\x6e\x4e\x6b\x91\x9a\x2c\x49\x68\xe9\x94\xb1\x98\x90\x87\xe3\x3d\xc0\x91\xa5\x38", 213); memcpy((void*)0x20000452, "\x41\x3a\xa1\xc1\xb4\xab\x65\x17\x04\xfc\x11\x75\xfd\xa3\x7d\x45\x30\xd5\xa1\x20\x10\xfb\xf9\x36\x9f\x30\x6b\x4f\x2e\xa3\x4c\xe5\xe2\xdf\xf2\xaf\xc3\x4c\xb5\x70\x7d\x16\xc3\x96\xc4\xcd\xdf\x37\x82\x83\x87\x55\xac\xa8\xd1\x9c\xb1\xb7\xea\x15\xd7\x64\xcc\xb5\x55\xb7\x7d\xeb\x17\x0c\xb6\x0c\x79\xb0\x90\x26\x6d\x43\xcd\xe8\x1a\x68\x43\x78\xc5\xcb\x34\x53\xf2\x2b\x23\x23\x65\xed\xd2\x03\x12\xd7\x86\x8e\x1c\x34\x91\x26\x37\x5b\x1c\x8d\xa9\x69\xff\x3e\x5a\xea\xfa\x13\x34\x19\x80\x7b\xea\x25\x41\x3f\xb5\x37\xdd\x62\xdb\xb6\x0f\x04\x9c\x1b\x5b\x0a\x48\x83\x3c\x2e\x92\x72\x42\x2d\xfd\x10\xdc\x9a\x85\x71\x30\xe9\x8d\x8d\x44\xda\xa1\xe2\x44\x20\xb6\x9d\x83\x8d\x89\x8b\x54\x9f\x5e\xbf\xc9\x44\xa2\x1c\x30\x70\x00\x1b\x06\x54\x3e\x48\xdd\x64\xe7\x6f\xeb\x50\x4e\xff\x54\x5d\x93\xb8\x57\xf9\x99\xba\x07\x14\xfe\x7b\x50\x89\xa8\xb5\xb8\x4c\x73\x46\xae\x74\xc3\x7e\x53\x64\x24\xb9\x3c\x35\x9f\x44\x66\xa5\x5f", 225); memcpy((void*)0x20000533, "\xa3\x85\x40\x1f\x31\xcb\x4c\xc3\x22\xd1\x1f\x26\x22\xb6\x27\xec\x35\x08\x6d\x16\x0e\xde\xd1\xb5\x85\x49\x83\x63\x0c\x3b\x01\xb1\xbe\xfc\x2b\x62\xd2\x04\x32\xf8\xf7\xdd\xb5\x6d\x8a\x18\x35\x2e\xf2\x6c\x0c\x0d\x99\xbe\x91\x42\x70\x39\xf1\xbb\x19\xaa\x03\x7f\x3c\xeb\x62\xee\xe7\x70\xfe\xa8\x8a\xd1\xb8\x48\xd3\xd5\x47\xc7\xf5\xb2\xcb\x5a\x13\xb7\x15\xc5\x87\x9e\xbe\x31\xdc\xf9\xdf\x3d\x36\x3b\x65\x80\x6c\x78\x34\xe0\x33\x7c\xae\x3f\x1b\x04\x80\xf4\x59\x2c\x7b\xb3\x6f\x69\x2f\xef\xfe\x3d\x36\x40\xd1\xdc\x6d\xbe\x40\x62\x77\x39\xe2\xb6\x9c\x65\x7f\xb9\x05\x9a\x22\x77\x6e\x7f\xd2\xab\x4b\x1b\xfd\xef\xc0\x35\xc6\x05\x61\x15\x7a\x83\xa1\x8f\x9c\x1c\x79\x8d\x56\x7d\x90\xbb\x70\x84\xf2\xac\x4f\x3b\x16", 175); syscall(SYS_test, 0x200002c0, 4, 0, 0, 0, 0); break; case 9: *(uint8_t*)0x20000600 = 4; *(uint8_t*)0x20000601 = 4; *(uint8_t*)0x20000602 = 7; *(uint8_t*)0x20000603 = 9; *(uint8_t*)0x20000604 = 7; *(uint8_t*)0x20000605 = 7; *(uint8_t*)0x20000606 = 9; *(uint8_t*)0x20000607 = 9; *(uint8_t*)0x20000608 = 9; syscall(SYS_test, 0x20000600, 0, 0, 0, 0, 0); break; case 10: memcpy((void*)0x20000000, "\000", 1); *(uint16_t*)0x20000040 = htobe16(1); *(uint16_t*)0x20000042 = htobe16(0xfff); *(uint16_t*)0x20000044 = htobe16(0x6e); *(uint16_t*)0x20000046 = htobe16(1); *(uint16_t*)0x20000048 = htobe16(4); *(uint16_t*)0x2000004a = htobe16(1); *(uint16_t*)0x2000004c = htobe16(0x8001); syz_compare(0x20000000, 1, 0x20000040, 0xe); break; case 11: syz_compare_int(2, 0x3f, 7, 0, 0); break; case 12: syz_errno(2); break; case 13: memcpy((void*)0x20000080, "\xa3\x2f\x13\xf5\x44\xef\xac\x4b\x66\x15\x8b\x22\x62\x99\x6b\x6b\x82\x69\x7c\x03\xe8\xfd\x6f\xc2\x98\xa7\xd8\x28\xf7\x6b\xe9\xbf\xad\x63\xf6\x8f\x7c\x8f\x27\xf3\x88\xab\x4c\xd5\x6b\x3f\xa7\x20\x5b\x7f", 50); syz_execute_func(0x20000080); break; case 14: syz_exit(0x7ff); break; case 15: syz_mmap(0x20ffd000, 0x2000); break; case 16: syz_sleep_ms(0x1f); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); for (procid = 0; procid < 4; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; } compiler invocation: gcc [-o /tmp/syz-executor402586301 -DGOOS_test=1 -DGOARCH_32_fork_shmem=1 -DHOSTGOOS_linux=1 -x c - -m32 -static -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-overflow] --- FAIL: TestGenerate/test/32_fork_shmem/7 (1.75s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox: Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: test$csum_ipv6_icmp(&(0x7f0000000000)={{"0003c9fb103f944285af6bd6b1d2d285", "f795a6c7d74af73790513134a2a4da33"}, {0x0, "4ff2d0d3de8605cd783bcb2d9b6602cd32ba970b3a6940b92d0eb5d7a2ca93c745f8151ee14ffd206fe36a2ac641c1efc44ea2470ecdca10eb3aa0eb31aba343fa87904b842e1f6d59d17ef37361e5a2cce750a06300aae7d8a8a832cb91196d2940a38fee470229517756c0ee0b7328ce107577a278bd4483fd7259497b4b8e6deaa4d049391297ec0ab776144ba9b7d9b4f0e43de0527ae5b16efbec71fe8219d34d4a5f8b431e3467ba9a2b308c91572dbf5dcf02eccbc7eab77ef6b2b96f3f2449dd2b869e3ec04e67"}}) foo$fmt4(&(0x7f0000000100)) foo$fmt0(&(0x7f0000000140)=0x9) mutate_array2(&(0x7f0000000180)=[{0x5}, {0xfe}]) test$length21(&(0x7f00000001c0)=0x53f4, 0x40) test$hint_data(&(0x7f0000000200)="e30e7deeda0a65eb519677cf24b25d43b4bfbe35667c33d1aecdbaff0f84318309a6f446b745348f7d541b01984197aafa0ce924687fd609420f0705c8563de2e86f41348778e045a4b0137584ba10653be5fcad1122807776e5e3f571967c9df593d27a95dc4f6ee1dc75b95d13b237dfe3f165812f28c3530b2404f2977bcfee834db02336f4f5c968417d11b4563fea1882a0693c475da6a44f1cbcaf9c1f105783") test_length15(0x5, 0x2) mutate_integer2(0x1, 0x7, 0x100, 0x3, 0x7) test$length25(&(0x7f00000002c0)=["c6578d6248c89125ed1b60a204647b0d09a01814cca5181f20ff878f0121e7e314a14bea6e26eb7e24a0bb49b88db47020b617fa17d2720eb848d5687aca427d4fba374c0f344936f4f350ab576134a78c465fc3f4179c65d2a99aca52f2ed3a5e781e8189a586ef65e80303070d5e4798aec408fa63fcc15cb9aee5b8d89adc83284966d7db4f4f2b3ddb4064a7b85cb53f6e16c8fd04f35355fceab16ead62a9395c95a0ad50745ba84b1d2ee66cc989daa977b8ab7a4546a5a20945", "01a6952f453c7471d83b04963251684b55417195bbc69af1cd93e2d5c3bc768d2e9092723c26c369a5b1a77b341384233daab7037e0f3227a6070f148de36e5652bb6887b92be7c1459c5a9d4a56f24352160fd2d9f1b5b335f63654733af16e33831eecc1cca55908045ddfd909e7d356df0012496d88f939c9842bfe67ecf56f0a4ce6a38c6e00316c874bc13441b5f9fb466df0bb4e5993142079efe917b09b1d8b78c08d3f78af1cf63efe49e83721d7e7b0003637034b79bfb488596eb0ff6e4e6b919a2c4968e994b1989087e33dc091a538", "413aa1c1b4ab651704fc1175fda37d4530d5a12010fbf9369f306b4f2ea34ce5e2dff2afc34cb5707d16c396c4cddf3782838755aca8d19cb1b7ea15d764ccb555b77deb170cb60c79b090266d43cde81a684378c5cb3453f22b232365edd20312d7868e1c349126375b1c8da969ff3e5aeafa133419807bea25413fb537dd62dbb60f049c1b5b0a48833c2e9272422dfd10dc9a857130e98d8d44daa1e24420b69d838d898b549f5ebfc944a21c3070001b06543e48dd64e76feb504eff545d93b857f999ba0714fe7b5089a8b5b84c7346ae74c37e536424b93c359f4466a55f", "a385401f31cb4cc322d11f2622b627ec35086d160eded1b5854983630c3b01b1befc2b62d20432f8f7ddb56d8a18352ef26c0c0d99be91427039f1bb19aa037f3ceb62eee770fea88ad1b848d3d547c7f5b2cb5a13b715c5879ebe31dcf9df3d363b65806c7834e0337cae3f1b0480f4592c7bb36f692feffe3d3640d1dc6dbe40627739e2b69c657fb9059a22776e7fd2ab4b1bfdefc035c60561157a83a18f9c1c798d567d90bb7084f2ac4f3b16"], 0x4) test$length20(&(0x7f0000000600)={{{0x4, 0x4, 0x7, 0x9}, 0x7, 0x7, 0x9}, 0x9, 0x9}) syz_compare(&(0x7f0000000000)='\x00', 0x1, &(0x7f0000000040)=@arr16be=[0x1, 0xfff, 0x6e, 0x1, 0x4, 0x1, 0x8001], 0xe) syz_compare_int$2(0x2, 0x3f, 0x7) syz_errno(0x2) syz_execute_func(&(0x7f0000000080)="a32f13f544efac4b66158b2262996b6b82697c03e8fd6fc298a7d828f76be9bfad63f68f7c8f27f388ab4cd56b3fa7205b7f") syz_exit(0x7ff) syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_sleep_ms(0x1f) csource_test.go:124: 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 static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } 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[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } 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 { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static long syz_mmap(volatile long a0, volatile long a1) { return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); } static long syz_errno(volatile long v) { errno = v; return v == 0 ? 0 : -1; } static long syz_exit(volatile long status) { _exit(status); return 0; } static long syz_sleep_ms(volatile long ms) { sleep_ms(ms); return 0; } static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { errno = EBADF; goto error; } if (memcmp((void*)want, (void*)got, want_len)) { errno = EINVAL; goto error; } return 0; error: return -1; } static long syz_compare_int(volatile long n, ...) { va_list args; va_start(args, n); long v0 = va_arg(args, long); long v1 = va_arg(args, long); long v2 = va_arg(args, long); long v3 = va_arg(args, long); va_end(args); if (n < 2 || n > 4) return errno = E2BIG, -1; if (n <= 2 && v2 != 0) return errno = EFAULT, -1; if (n <= 3 && v3 != 0) return errno = EFAULT, -1; if (v0 != v1) return errno = EINVAL, -1; if (n > 2 && v0 != v2) return errno = EINVAL, -1; if (n > 3 && v0 != v3) return errno = EINVAL, -1; return 0; } 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); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } #ifndef SYS_foo #define SYS_foo 0 #endif #ifndef SYS_mutate_array2 #define SYS_mutate_array2 0 #endif #ifndef SYS_mutate_integer2 #define SYS_mutate_integer2 0 #endif #ifndef SYS_test #define SYS_test 0 #endif #ifndef SYS_test_length15 #define SYS_test_length15 0 #endif void execute_call(int call) { switch (call) { case 0: memcpy((void*)0x20000000, "\x00\x03\xc9\xfb\x10\x3f\x94\x42\x85\xaf\x6b\xd6\xb1\xd2\xd2\x85", 16); memcpy((void*)0x20000010, "\xf7\x95\xa6\xc7\xd7\x4a\xf7\x37\x90\x51\x31\x34\xa2\xa4\xda\x33", 16); *(uint16_t*)0x20000020 = 0; memcpy((void*)0x20000022, "\x4f\xf2\xd0\xd3\xde\x86\x05\xcd\x78\x3b\xcb\x2d\x9b\x66\x02\xcd\x32\xba\x97\x0b\x3a\x69\x40\xb9\x2d\x0e\xb5\xd7\xa2\xca\x93\xc7\x45\xf8\x15\x1e\xe1\x4f\xfd\x20\x6f\xe3\x6a\x2a\xc6\x41\xc1\xef\xc4\x4e\xa2\x47\x0e\xcd\xca\x10\xeb\x3a\xa0\xeb\x31\xab\xa3\x43\xfa\x87\x90\x4b\x84\x2e\x1f\x6d\x59\xd1\x7e\xf3\x73\x61\xe5\xa2\xcc\xe7\x50\xa0\x63\x00\xaa\xe7\xd8\xa8\xa8\x32\xcb\x91\x19\x6d\x29\x40\xa3\x8f\xee\x47\x02\x29\x51\x77\x56\xc0\xee\x0b\x73\x28\xce\x10\x75\x77\xa2\x78\xbd\x44\x83\xfd\x72\x59\x49\x7b\x4b\x8e\x6d\xea\xa4\xd0\x49\x39\x12\x97\xec\x0a\xb7\x76\x14\x4b\xa9\xb7\xd9\xb4\xf0\xe4\x3d\xe0\x52\x7a\xe5\xb1\x6e\xfb\xec\x71\xfe\x82\x19\xd3\x4d\x4a\x5f\x8b\x43\x1e\x34\x67\xba\x9a\x2b\x30\x8c\x91\x57\x2d\xbf\x5d\xcf\x02\xec\xcb\xc7\xea\xb7\x7e\xf6\xb2\xb9\x6f\x3f\x24\x49\xdd\x2b\x86\x9e\x3e\xc0\x4e\x67", 203); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000000, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000010, 16); uint32_t csum_1_chunk_2 = 0xcd000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x3a000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000020, 205); *(uint16_t*)0x20000020 = csum_inet_digest(&csum_1); syscall(SYS_test, 0x20000000, 0, 0, 0, 0, 0); break; case 1: sprintf((char*)0x20000100, "%020llu", (long long)0); syscall(SYS_foo, 0x20000100, 0); break; case 2: sprintf((char*)0x20000140, "%020llu", (long long)9); syscall(SYS_foo, 0x20000140, 0); break; case 3: *(uint8_t*)0x20000180 = 5; *(uint8_t*)0x20000181 = 0xfe; syscall(SYS_mutate_array2, 0x20000180); break; case 4: *(uint64_t*)0x200001c0 = 0x53f4; syscall(SYS_test, 0x200001c0, 0x40, 0, 0, 0, 0); break; case 5: memcpy((void*)0x20000200, "\xe3\x0e\x7d\xee\xda\x0a\x65\xeb\x51\x96\x77\xcf\x24\xb2\x5d\x43\xb4\xbf\xbe\x35\x66\x7c\x33\xd1\xae\xcd\xba\xff\x0f\x84\x31\x83\x09\xa6\xf4\x46\xb7\x45\x34\x8f\x7d\x54\x1b\x01\x98\x41\x97\xaa\xfa\x0c\xe9\x24\x68\x7f\xd6\x09\x42\x0f\x07\x05\xc8\x56\x3d\xe2\xe8\x6f\x41\x34\x87\x78\xe0\x45\xa4\xb0\x13\x75\x84\xba\x10\x65\x3b\xe5\xfc\xad\x11\x22\x80\x77\x76\xe5\xe3\xf5\x71\x96\x7c\x9d\xf5\x93\xd2\x7a\x95\xdc\x4f\x6e\xe1\xdc\x75\xb9\x5d\x13\xb2\x37\xdf\xe3\xf1\x65\x81\x2f\x28\xc3\x53\x0b\x24\x04\xf2\x97\x7b\xcf\xee\x83\x4d\xb0\x23\x36\xf4\xf5\xc9\x68\x41\x7d\x11\xb4\x56\x3f\xea\x18\x82\xa0\x69\x3c\x47\x5d\xa6\xa4\x4f\x1c\xbc\xaf\x9c\x1f\x10\x57\x83", 163); syscall(SYS_test, 0x20000200, 0, 0, 0, 0, 0); break; case 6: syscall(SYS_test_length15, 5, 2); break; case 7: syscall(SYS_mutate_integer2, 1ull, 7ull, 0x100, 3, 7); break; case 8: memcpy((void*)0x200002c0, "\xc6\x57\x8d\x62\x48\xc8\x91\x25\xed\x1b\x60\xa2\x04\x64\x7b\x0d\x09\xa0\x18\x14\xcc\xa5\x18\x1f\x20\xff\x87\x8f\x01\x21\xe7\xe3\x14\xa1\x4b\xea\x6e\x26\xeb\x7e\x24\xa0\xbb\x49\xb8\x8d\xb4\x70\x20\xb6\x17\xfa\x17\xd2\x72\x0e\xb8\x48\xd5\x68\x7a\xca\x42\x7d\x4f\xba\x37\x4c\x0f\x34\x49\x36\xf4\xf3\x50\xab\x57\x61\x34\xa7\x8c\x46\x5f\xc3\xf4\x17\x9c\x65\xd2\xa9\x9a\xca\x52\xf2\xed\x3a\x5e\x78\x1e\x81\x89\xa5\x86\xef\x65\xe8\x03\x03\x07\x0d\x5e\x47\x98\xae\xc4\x08\xfa\x63\xfc\xc1\x5c\xb9\xae\xe5\xb8\xd8\x9a\xdc\x83\x28\x49\x66\xd7\xdb\x4f\x4f\x2b\x3d\xdb\x40\x64\xa7\xb8\x5c\xb5\x3f\x6e\x16\xc8\xfd\x04\xf3\x53\x55\xfc\xea\xb1\x6e\xad\x62\xa9\x39\x5c\x95\xa0\xad\x50\x74\x5b\xa8\x4b\x1d\x2e\xe6\x6c\xc9\x89\xda\xa9\x77\xb8\xab\x7a\x45\x46\xa5\xa2\x09\x45", 189); memcpy((void*)0x2000037d, "\x01\xa6\x95\x2f\x45\x3c\x74\x71\xd8\x3b\x04\x96\x32\x51\x68\x4b\x55\x41\x71\x95\xbb\xc6\x9a\xf1\xcd\x93\xe2\xd5\xc3\xbc\x76\x8d\x2e\x90\x92\x72\x3c\x26\xc3\x69\xa5\xb1\xa7\x7b\x34\x13\x84\x23\x3d\xaa\xb7\x03\x7e\x0f\x32\x27\xa6\x07\x0f\x14\x8d\xe3\x6e\x56\x52\xbb\x68\x87\xb9\x2b\xe7\xc1\x45\x9c\x5a\x9d\x4a\x56\xf2\x43\x52\x16\x0f\xd2\xd9\xf1\xb5\xb3\x35\xf6\x36\x54\x73\x3a\xf1\x6e\x33\x83\x1e\xec\xc1\xcc\xa5\x59\x08\x04\x5d\xdf\xd9\x09\xe7\xd3\x56\xdf\x00\x12\x49\x6d\x88\xf9\x39\xc9\x84\x2b\xfe\x67\xec\xf5\x6f\x0a\x4c\xe6\xa3\x8c\x6e\x00\x31\x6c\x87\x4b\xc1\x34\x41\xb5\xf9\xfb\x46\x6d\xf0\xbb\x4e\x59\x93\x14\x20\x79\xef\xe9\x17\xb0\x9b\x1d\x8b\x78\xc0\x8d\x3f\x78\xaf\x1c\xf6\x3e\xfe\x49\xe8\x37\x21\xd7\xe7\xb0\x00\x36\x37\x03\x4b\x79\xbf\xb4\x88\x59\x6e\xb0\xff\x6e\x4e\x6b\x91\x9a\x2c\x49\x68\xe9\x94\xb1\x98\x90\x87\xe3\x3d\xc0\x91\xa5\x38", 213); memcpy((void*)0x20000452, "\x41\x3a\xa1\xc1\xb4\xab\x65\x17\x04\xfc\x11\x75\xfd\xa3\x7d\x45\x30\xd5\xa1\x20\x10\xfb\xf9\x36\x9f\x30\x6b\x4f\x2e\xa3\x4c\xe5\xe2\xdf\xf2\xaf\xc3\x4c\xb5\x70\x7d\x16\xc3\x96\xc4\xcd\xdf\x37\x82\x83\x87\x55\xac\xa8\xd1\x9c\xb1\xb7\xea\x15\xd7\x64\xcc\xb5\x55\xb7\x7d\xeb\x17\x0c\xb6\x0c\x79\xb0\x90\x26\x6d\x43\xcd\xe8\x1a\x68\x43\x78\xc5\xcb\x34\x53\xf2\x2b\x23\x23\x65\xed\xd2\x03\x12\xd7\x86\x8e\x1c\x34\x91\x26\x37\x5b\x1c\x8d\xa9\x69\xff\x3e\x5a\xea\xfa\x13\x34\x19\x80\x7b\xea\x25\x41\x3f\xb5\x37\xdd\x62\xdb\xb6\x0f\x04\x9c\x1b\x5b\x0a\x48\x83\x3c\x2e\x92\x72\x42\x2d\xfd\x10\xdc\x9a\x85\x71\x30\xe9\x8d\x8d\x44\xda\xa1\xe2\x44\x20\xb6\x9d\x83\x8d\x89\x8b\x54\x9f\x5e\xbf\xc9\x44\xa2\x1c\x30\x70\x00\x1b\x06\x54\x3e\x48\xdd\x64\xe7\x6f\xeb\x50\x4e\xff\x54\x5d\x93\xb8\x57\xf9\x99\xba\x07\x14\xfe\x7b\x50\x89\xa8\xb5\xb8\x4c\x73\x46\xae\x74\xc3\x7e\x53\x64\x24\xb9\x3c\x35\x9f\x44\x66\xa5\x5f", 225); memcpy((void*)0x20000533, "\xa3\x85\x40\x1f\x31\xcb\x4c\xc3\x22\xd1\x1f\x26\x22\xb6\x27\xec\x35\x08\x6d\x16\x0e\xde\xd1\xb5\x85\x49\x83\x63\x0c\x3b\x01\xb1\xbe\xfc\x2b\x62\xd2\x04\x32\xf8\xf7\xdd\xb5\x6d\x8a\x18\x35\x2e\xf2\x6c\x0c\x0d\x99\xbe\x91\x42\x70\x39\xf1\xbb\x19\xaa\x03\x7f\x3c\xeb\x62\xee\xe7\x70\xfe\xa8\x8a\xd1\xb8\x48\xd3\xd5\x47\xc7\xf5\xb2\xcb\x5a\x13\xb7\x15\xc5\x87\x9e\xbe\x31\xdc\xf9\xdf\x3d\x36\x3b\x65\x80\x6c\x78\x34\xe0\x33\x7c\xae\x3f\x1b\x04\x80\xf4\x59\x2c\x7b\xb3\x6f\x69\x2f\xef\xfe\x3d\x36\x40\xd1\xdc\x6d\xbe\x40\x62\x77\x39\xe2\xb6\x9c\x65\x7f\xb9\x05\x9a\x22\x77\x6e\x7f\xd2\xab\x4b\x1b\xfd\xef\xc0\x35\xc6\x05\x61\x15\x7a\x83\xa1\x8f\x9c\x1c\x79\x8d\x56\x7d\x90\xbb\x70\x84\xf2\xac\x4f\x3b\x16", 175); syscall(SYS_test, 0x200002c0, 4, 0, 0, 0, 0); break; case 9: *(uint8_t*)0x20000600 = 4; *(uint8_t*)0x20000601 = 4; *(uint8_t*)0x20000602 = 7; *(uint8_t*)0x20000603 = 9; *(uint8_t*)0x20000604 = 7; *(uint8_t*)0x20000605 = 7; *(uint8_t*)0x20000606 = 9; *(uint8_t*)0x20000607 = 9; *(uint8_t*)0x20000608 = 9; syscall(SYS_test, 0x20000600, 0, 0, 0, 0, 0); break; case 10: memcpy((void*)0x20000000, "\000", 1); *(uint16_t*)0x20000040 = htobe16(1); *(uint16_t*)0x20000042 = htobe16(0xfff); *(uint16_t*)0x20000044 = htobe16(0x6e); *(uint16_t*)0x20000046 = htobe16(1); *(uint16_t*)0x20000048 = htobe16(4); *(uint16_t*)0x2000004a = htobe16(1); *(uint16_t*)0x2000004c = htobe16(0x8001); syz_compare(0x20000000, 1, 0x20000040, 0xe); break; case 11: syz_compare_int(2, 0x3f, 7, 0, 0); break; case 12: syz_errno(2); break; case 13: memcpy((void*)0x20000080, "\xa3\x2f\x13\xf5\x44\xef\xac\x4b\x66\x15\x8b\x22\x62\x99\x6b\x6b\x82\x69\x7c\x03\xe8\xfd\x6f\xc2\x98\xa7\xd8\x28\xf7\x6b\xe9\xbf\xad\x63\xf6\x8f\x7c\x8f\x27\xf3\x88\xab\x4c\xd5\x6b\x3f\xa7\x20\x5b\x7f", 50); syz_execute_func(0x20000080); break; case 14: syz_exit(0x7ff); break; case 15: syz_mmap(0x20ffd000, 0x2000); break; case 16: syz_sleep_ms(0x1f); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); use_temporary_dir(); loop(); return 0; } compiler invocation: gcc [-o /tmp/syz-executor128653048 -DGOOS_test=1 -DGOARCH_32_fork_shmem=1 -DHOSTGOOS_linux=1 -x c - -m32 -static -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-overflow] --- FAIL: TestGenerate/test/32_fork_shmem/4 (1.75s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:10 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false UseTmpDir:true HandleSegv:false Repro:false Trace:false} program: test$csum_ipv6_icmp(&(0x7f0000000000)={{"0003c9fb103f944285af6bd6b1d2d285", "f795a6c7d74af73790513134a2a4da33"}, {0x0, "4ff2d0d3de8605cd783bcb2d9b6602cd32ba970b3a6940b92d0eb5d7a2ca93c745f8151ee14ffd206fe36a2ac641c1efc44ea2470ecdca10eb3aa0eb31aba343fa87904b842e1f6d59d17ef37361e5a2cce750a06300aae7d8a8a832cb91196d2940a38fee470229517756c0ee0b7328ce107577a278bd4483fd7259497b4b8e6deaa4d049391297ec0ab776144ba9b7d9b4f0e43de0527ae5b16efbec71fe8219d34d4a5f8b431e3467ba9a2b308c91572dbf5dcf02eccbc7eab77ef6b2b96f3f2449dd2b869e3ec04e67"}}) foo$fmt4(&(0x7f0000000100)) foo$fmt0(&(0x7f0000000140)=0x9) mutate_array2(&(0x7f0000000180)=[{0x5}, {0xfe}]) test$length21(&(0x7f00000001c0)=0x53f4, 0x40) test$hint_data(&(0x7f0000000200)="e30e7deeda0a65eb519677cf24b25d43b4bfbe35667c33d1aecdbaff0f84318309a6f446b745348f7d541b01984197aafa0ce924687fd609420f0705c8563de2e86f41348778e045a4b0137584ba10653be5fcad1122807776e5e3f571967c9df593d27a95dc4f6ee1dc75b95d13b237dfe3f165812f28c3530b2404f2977bcfee834db02336f4f5c968417d11b4563fea1882a0693c475da6a44f1cbcaf9c1f105783") test_length15(0x5, 0x2) mutate_integer2(0x1, 0x7, 0x100, 0x3, 0x7) test$length25(&(0x7f00000002c0)=["c6578d6248c89125ed1b60a204647b0d09a01814cca5181f20ff878f0121e7e314a14bea6e26eb7e24a0bb49b88db47020b617fa17d2720eb848d5687aca427d4fba374c0f344936f4f350ab576134a78c465fc3f4179c65d2a99aca52f2ed3a5e781e8189a586ef65e80303070d5e4798aec408fa63fcc15cb9aee5b8d89adc83284966d7db4f4f2b3ddb4064a7b85cb53f6e16c8fd04f35355fceab16ead62a9395c95a0ad50745ba84b1d2ee66cc989daa977b8ab7a4546a5a20945", "01a6952f453c7471d83b04963251684b55417195bbc69af1cd93e2d5c3bc768d2e9092723c26c369a5b1a77b341384233daab7037e0f3227a6070f148de36e5652bb6887b92be7c1459c5a9d4a56f24352160fd2d9f1b5b335f63654733af16e33831eecc1cca55908045ddfd909e7d356df0012496d88f939c9842bfe67ecf56f0a4ce6a38c6e00316c874bc13441b5f9fb466df0bb4e5993142079efe917b09b1d8b78c08d3f78af1cf63efe49e83721d7e7b0003637034b79bfb488596eb0ff6e4e6b919a2c4968e994b1989087e33dc091a538", "413aa1c1b4ab651704fc1175fda37d4530d5a12010fbf9369f306b4f2ea34ce5e2dff2afc34cb5707d16c396c4cddf3782838755aca8d19cb1b7ea15d764ccb555b77deb170cb60c79b090266d43cde81a684378c5cb3453f22b232365edd20312d7868e1c349126375b1c8da969ff3e5aeafa133419807bea25413fb537dd62dbb60f049c1b5b0a48833c2e9272422dfd10dc9a857130e98d8d44daa1e24420b69d838d898b549f5ebfc944a21c3070001b06543e48dd64e76feb504eff545d93b857f999ba0714fe7b5089a8b5b84c7346ae74c37e536424b93c359f4466a55f", "a385401f31cb4cc322d11f2622b627ec35086d160eded1b5854983630c3b01b1befc2b62d20432f8f7ddb56d8a18352ef26c0c0d99be91427039f1bb19aa037f3ceb62eee770fea88ad1b848d3d547c7f5b2cb5a13b715c5879ebe31dcf9df3d363b65806c7834e0337cae3f1b0480f4592c7bb36f692feffe3d3640d1dc6dbe40627739e2b69c657fb9059a22776e7fd2ab4b1bfdefc035c60561157a83a18f9c1c798d567d90bb7084f2ac4f3b16"], 0x4) test$length20(&(0x7f0000000600)={{{0x4, 0x4, 0x7, 0x9}, 0x7, 0x7, 0x9}, 0x9, 0x9}) syz_compare(&(0x7f0000000000)='\x00', 0x1, &(0x7f0000000040)=@arr16be=[0x1, 0xfff, 0x6e, 0x1, 0x4, 0x1, 0x8001], 0xe) syz_compare_int$2(0x2, 0x3f, 0x7) syz_errno(0x2) syz_execute_func(&(0x7f0000000080)="a32f13f544efac4b66158b2262996b6b82697c03e8fd6fc298a7d828f76be9bfad63f68f7c8f27f388ab4cd56b3fa7205b7f") syz_exit(0x7ff) syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_sleep_ms(0x1f) csource_test.go:124: 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 static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } 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[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void __attribute__((noinline)) remove_dir(const char* dir) { DIR* dp = opendir(dir); if (dp == NULL) { if (errno == EACCES) { if (rmdir(dir)) exit(1); return; } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } if (unlink(filename)) exit(1); } closedir(dp); if (rmdir(dir)) exit(1); } 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 { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static long syz_mmap(volatile long a0, volatile long a1) { return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); } static long syz_errno(volatile long v) { errno = v; return v == 0 ? 0 : -1; } static long syz_exit(volatile long status) { _exit(status); return 0; } static long syz_sleep_ms(volatile long ms) { sleep_ms(ms); return 0; } static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { errno = EBADF; goto error; } if (memcmp((void*)want, (void*)got, want_len)) { errno = EINVAL; goto error; } return 0; error: return -1; } static long syz_compare_int(volatile long n, ...) { va_list args; va_start(args, n); long v0 = va_arg(args, long); long v1 = va_arg(args, long); long v2 = va_arg(args, long); long v3 = va_arg(args, long); va_end(args); if (n < 2 || n > 4) return errno = E2BIG, -1; if (n <= 2 && v2 != 0) return errno = EFAULT, -1; if (n <= 3 && v3 != 0) return errno = EFAULT, -1; if (v0 != v1) return errno = EINVAL, -1; if (n > 2 && v0 != v2) return errno = EINVAL, -1; if (n > 3 && v0 != v3) return errno = EINVAL, -1; return 0; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } 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); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (; iter < 10; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } #ifndef SYS_foo #define SYS_foo 0 #endif #ifndef SYS_mutate_array2 #define SYS_mutate_array2 0 #endif #ifndef SYS_mutate_integer2 #define SYS_mutate_integer2 0 #endif #ifndef SYS_test #define SYS_test 0 #endif #ifndef SYS_test_length15 #define SYS_test_length15 0 #endif void execute_call(int call) { switch (call) { case 0: memcpy((void*)0x20000000, "\x00\x03\xc9\xfb\x10\x3f\x94\x42\x85\xaf\x6b\xd6\xb1\xd2\xd2\x85", 16); memcpy((void*)0x20000010, "\xf7\x95\xa6\xc7\xd7\x4a\xf7\x37\x90\x51\x31\x34\xa2\xa4\xda\x33", 16); *(uint16_t*)0x20000020 = 0; memcpy((void*)0x20000022, "\x4f\xf2\xd0\xd3\xde\x86\x05\xcd\x78\x3b\xcb\x2d\x9b\x66\x02\xcd\x32\xba\x97\x0b\x3a\x69\x40\xb9\x2d\x0e\xb5\xd7\xa2\xca\x93\xc7\x45\xf8\x15\x1e\xe1\x4f\xfd\x20\x6f\xe3\x6a\x2a\xc6\x41\xc1\xef\xc4\x4e\xa2\x47\x0e\xcd\xca\x10\xeb\x3a\xa0\xeb\x31\xab\xa3\x43\xfa\x87\x90\x4b\x84\x2e\x1f\x6d\x59\xd1\x7e\xf3\x73\x61\xe5\xa2\xcc\xe7\x50\xa0\x63\x00\xaa\xe7\xd8\xa8\xa8\x32\xcb\x91\x19\x6d\x29\x40\xa3\x8f\xee\x47\x02\x29\x51\x77\x56\xc0\xee\x0b\x73\x28\xce\x10\x75\x77\xa2\x78\xbd\x44\x83\xfd\x72\x59\x49\x7b\x4b\x8e\x6d\xea\xa4\xd0\x49\x39\x12\x97\xec\x0a\xb7\x76\x14\x4b\xa9\xb7\xd9\xb4\xf0\xe4\x3d\xe0\x52\x7a\xe5\xb1\x6e\xfb\xec\x71\xfe\x82\x19\xd3\x4d\x4a\x5f\x8b\x43\x1e\x34\x67\xba\x9a\x2b\x30\x8c\x91\x57\x2d\xbf\x5d\xcf\x02\xec\xcb\xc7\xea\xb7\x7e\xf6\xb2\xb9\x6f\x3f\x24\x49\xdd\x2b\x86\x9e\x3e\xc0\x4e\x67", 203); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000000, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000010, 16); uint32_t csum_1_chunk_2 = 0xcd000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x3a000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000020, 205); *(uint16_t*)0x20000020 = csum_inet_digest(&csum_1); syscall(SYS_test, 0x20000000, 0, 0, 0, 0, 0); break; case 1: sprintf((char*)0x20000100, "%020llu", (long long)0); syscall(SYS_foo, 0x20000100, 0); break; case 2: sprintf((char*)0x20000140, "%020llu", (long long)9); syscall(SYS_foo, 0x20000140, 0); break; case 3: *(uint8_t*)0x20000180 = 5; *(uint8_t*)0x20000181 = 0xfe; syscall(SYS_mutate_array2, 0x20000180); break; case 4: *(uint64_t*)0x200001c0 = 0x53f4; syscall(SYS_test, 0x200001c0, 0x40, 0, 0, 0, 0); break; case 5: memcpy((void*)0x20000200, "\xe3\x0e\x7d\xee\xda\x0a\x65\xeb\x51\x96\x77\xcf\x24\xb2\x5d\x43\xb4\xbf\xbe\x35\x66\x7c\x33\xd1\xae\xcd\xba\xff\x0f\x84\x31\x83\x09\xa6\xf4\x46\xb7\x45\x34\x8f\x7d\x54\x1b\x01\x98\x41\x97\xaa\xfa\x0c\xe9\x24\x68\x7f\xd6\x09\x42\x0f\x07\x05\xc8\x56\x3d\xe2\xe8\x6f\x41\x34\x87\x78\xe0\x45\xa4\xb0\x13\x75\x84\xba\x10\x65\x3b\xe5\xfc\xad\x11\x22\x80\x77\x76\xe5\xe3\xf5\x71\x96\x7c\x9d\xf5\x93\xd2\x7a\x95\xdc\x4f\x6e\xe1\xdc\x75\xb9\x5d\x13\xb2\x37\xdf\xe3\xf1\x65\x81\x2f\x28\xc3\x53\x0b\x24\x04\xf2\x97\x7b\xcf\xee\x83\x4d\xb0\x23\x36\xf4\xf5\xc9\x68\x41\x7d\x11\xb4\x56\x3f\xea\x18\x82\xa0\x69\x3c\x47\x5d\xa6\xa4\x4f\x1c\xbc\xaf\x9c\x1f\x10\x57\x83", 163); syscall(SYS_test, 0x20000200, 0, 0, 0, 0, 0); break; case 6: syscall(SYS_test_length15, 5, 2); break; case 7: syscall(SYS_mutate_integer2, 1ull, 7ull, 0x100, 3, 7); break; case 8: memcpy((void*)0x200002c0, "\xc6\x57\x8d\x62\x48\xc8\x91\x25\xed\x1b\x60\xa2\x04\x64\x7b\x0d\x09\xa0\x18\x14\xcc\xa5\x18\x1f\x20\xff\x87\x8f\x01\x21\xe7\xe3\x14\xa1\x4b\xea\x6e\x26\xeb\x7e\x24\xa0\xbb\x49\xb8\x8d\xb4\x70\x20\xb6\x17\xfa\x17\xd2\x72\x0e\xb8\x48\xd5\x68\x7a\xca\x42\x7d\x4f\xba\x37\x4c\x0f\x34\x49\x36\xf4\xf3\x50\xab\x57\x61\x34\xa7\x8c\x46\x5f\xc3\xf4\x17\x9c\x65\xd2\xa9\x9a\xca\x52\xf2\xed\x3a\x5e\x78\x1e\x81\x89\xa5\x86\xef\x65\xe8\x03\x03\x07\x0d\x5e\x47\x98\xae\xc4\x08\xfa\x63\xfc\xc1\x5c\xb9\xae\xe5\xb8\xd8\x9a\xdc\x83\x28\x49\x66\xd7\xdb\x4f\x4f\x2b\x3d\xdb\x40\x64\xa7\xb8\x5c\xb5\x3f\x6e\x16\xc8\xfd\x04\xf3\x53\x55\xfc\xea\xb1\x6e\xad\x62\xa9\x39\x5c\x95\xa0\xad\x50\x74\x5b\xa8\x4b\x1d\x2e\xe6\x6c\xc9\x89\xda\xa9\x77\xb8\xab\x7a\x45\x46\xa5\xa2\x09\x45", 189); memcpy((void*)0x2000037d, "\x01\xa6\x95\x2f\x45\x3c\x74\x71\xd8\x3b\x04\x96\x32\x51\x68\x4b\x55\x41\x71\x95\xbb\xc6\x9a\xf1\xcd\x93\xe2\xd5\xc3\xbc\x76\x8d\x2e\x90\x92\x72\x3c\x26\xc3\x69\xa5\xb1\xa7\x7b\x34\x13\x84\x23\x3d\xaa\xb7\x03\x7e\x0f\x32\x27\xa6\x07\x0f\x14\x8d\xe3\x6e\x56\x52\xbb\x68\x87\xb9\x2b\xe7\xc1\x45\x9c\x5a\x9d\x4a\x56\xf2\x43\x52\x16\x0f\xd2\xd9\xf1\xb5\xb3\x35\xf6\x36\x54\x73\x3a\xf1\x6e\x33\x83\x1e\xec\xc1\xcc\xa5\x59\x08\x04\x5d\xdf\xd9\x09\xe7\xd3\x56\xdf\x00\x12\x49\x6d\x88\xf9\x39\xc9\x84\x2b\xfe\x67\xec\xf5\x6f\x0a\x4c\xe6\xa3\x8c\x6e\x00\x31\x6c\x87\x4b\xc1\x34\x41\xb5\xf9\xfb\x46\x6d\xf0\xbb\x4e\x59\x93\x14\x20\x79\xef\xe9\x17\xb0\x9b\x1d\x8b\x78\xc0\x8d\x3f\x78\xaf\x1c\xf6\x3e\xfe\x49\xe8\x37\x21\xd7\xe7\xb0\x00\x36\x37\x03\x4b\x79\xbf\xb4\x88\x59\x6e\xb0\xff\x6e\x4e\x6b\x91\x9a\x2c\x49\x68\xe9\x94\xb1\x98\x90\x87\xe3\x3d\xc0\x91\xa5\x38", 213); memcpy((void*)0x20000452, "\x41\x3a\xa1\xc1\xb4\xab\x65\x17\x04\xfc\x11\x75\xfd\xa3\x7d\x45\x30\xd5\xa1\x20\x10\xfb\xf9\x36\x9f\x30\x6b\x4f\x2e\xa3\x4c\xe5\xe2\xdf\xf2\xaf\xc3\x4c\xb5\x70\x7d\x16\xc3\x96\xc4\xcd\xdf\x37\x82\x83\x87\x55\xac\xa8\xd1\x9c\xb1\xb7\xea\x15\xd7\x64\xcc\xb5\x55\xb7\x7d\xeb\x17\x0c\xb6\x0c\x79\xb0\x90\x26\x6d\x43\xcd\xe8\x1a\x68\x43\x78\xc5\xcb\x34\x53\xf2\x2b\x23\x23\x65\xed\xd2\x03\x12\xd7\x86\x8e\x1c\x34\x91\x26\x37\x5b\x1c\x8d\xa9\x69\xff\x3e\x5a\xea\xfa\x13\x34\x19\x80\x7b\xea\x25\x41\x3f\xb5\x37\xdd\x62\xdb\xb6\x0f\x04\x9c\x1b\x5b\x0a\x48\x83\x3c\x2e\x92\x72\x42\x2d\xfd\x10\xdc\x9a\x85\x71\x30\xe9\x8d\x8d\x44\xda\xa1\xe2\x44\x20\xb6\x9d\x83\x8d\x89\x8b\x54\x9f\x5e\xbf\xc9\x44\xa2\x1c\x30\x70\x00\x1b\x06\x54\x3e\x48\xdd\x64\xe7\x6f\xeb\x50\x4e\xff\x54\x5d\x93\xb8\x57\xf9\x99\xba\x07\x14\xfe\x7b\x50\x89\xa8\xb5\xb8\x4c\x73\x46\xae\x74\xc3\x7e\x53\x64\x24\xb9\x3c\x35\x9f\x44\x66\xa5\x5f", 225); memcpy((void*)0x20000533, "\xa3\x85\x40\x1f\x31\xcb\x4c\xc3\x22\xd1\x1f\x26\x22\xb6\x27\xec\x35\x08\x6d\x16\x0e\xde\xd1\xb5\x85\x49\x83\x63\x0c\x3b\x01\xb1\xbe\xfc\x2b\x62\xd2\x04\x32\xf8\xf7\xdd\xb5\x6d\x8a\x18\x35\x2e\xf2\x6c\x0c\x0d\x99\xbe\x91\x42\x70\x39\xf1\xbb\x19\xaa\x03\x7f\x3c\xeb\x62\xee\xe7\x70\xfe\xa8\x8a\xd1\xb8\x48\xd3\xd5\x47\xc7\xf5\xb2\xcb\x5a\x13\xb7\x15\xc5\x87\x9e\xbe\x31\xdc\xf9\xdf\x3d\x36\x3b\x65\x80\x6c\x78\x34\xe0\x33\x7c\xae\x3f\x1b\x04\x80\xf4\x59\x2c\x7b\xb3\x6f\x69\x2f\xef\xfe\x3d\x36\x40\xd1\xdc\x6d\xbe\x40\x62\x77\x39\xe2\xb6\x9c\x65\x7f\xb9\x05\x9a\x22\x77\x6e\x7f\xd2\xab\x4b\x1b\xfd\xef\xc0\x35\xc6\x05\x61\x15\x7a\x83\xa1\x8f\x9c\x1c\x79\x8d\x56\x7d\x90\xbb\x70\x84\xf2\xac\x4f\x3b\x16", 175); syscall(SYS_test, 0x200002c0, 4, 0, 0, 0, 0); break; case 9: *(uint8_t*)0x20000600 = 4; *(uint8_t*)0x20000601 = 4; *(uint8_t*)0x20000602 = 7; *(uint8_t*)0x20000603 = 9; *(uint8_t*)0x20000604 = 7; *(uint8_t*)0x20000605 = 7; *(uint8_t*)0x20000606 = 9; *(uint8_t*)0x20000607 = 9; *(uint8_t*)0x20000608 = 9; syscall(SYS_test, 0x20000600, 0, 0, 0, 0, 0); break; case 10: memcpy((void*)0x20000000, "\000", 1); *(uint16_t*)0x20000040 = htobe16(1); *(uint16_t*)0x20000042 = htobe16(0xfff); *(uint16_t*)0x20000044 = htobe16(0x6e); *(uint16_t*)0x20000046 = htobe16(1); *(uint16_t*)0x20000048 = htobe16(4); *(uint16_t*)0x2000004a = htobe16(1); *(uint16_t*)0x2000004c = htobe16(0x8001); syz_compare(0x20000000, 1, 0x20000040, 0xe); break; case 11: syz_compare_int(2, 0x3f, 7, 0, 0); break; case 12: syz_errno(2); break; case 13: memcpy((void*)0x20000080, "\xa3\x2f\x13\xf5\x44\xef\xac\x4b\x66\x15\x8b\x22\x62\x99\x6b\x6b\x82\x69\x7c\x03\xe8\xfd\x6f\xc2\x98\xa7\xd8\x28\xf7\x6b\xe9\xbf\xad\x63\xf6\x8f\x7c\x8f\x27\xf3\x88\xab\x4c\xd5\x6b\x3f\xa7\x20\x5b\x7f", 50); syz_execute_func(0x20000080); break; case 14: syz_exit(0x7ff); break; case 15: syz_mmap(0x20ffd000, 0x2000); break; case 16: syz_sleep_ms(0x1f); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); use_temporary_dir(); do_sandbox_none(); return 0; } compiler invocation: gcc [-o /tmp/syz-executor762257017 -DGOOS_test=1 -DGOARCH_32_fork_shmem=1 -DHOSTGOOS_linux=1 -x c - -m32 -static -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-overflow] --- FAIL: TestGenerate/test/32_fork_shmem/8 (1.75s) csource_test.go:123: opts: {Threaded:true Collide:false Repeat:true RepeatTimes:0 Procs:0 Sandbox:none Fault:false FaultCall:0 FaultNth:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false USB:false VhciInjection:false Wifi:false UseTmpDir:false HandleSegv:false Repro:false Trace:false} program: test$csum_ipv6_icmp(&(0x7f0000000000)={{"0003c9fb103f944285af6bd6b1d2d285", "f795a6c7d74af73790513134a2a4da33"}, {0x0, "4ff2d0d3de8605cd783bcb2d9b6602cd32ba970b3a6940b92d0eb5d7a2ca93c745f8151ee14ffd206fe36a2ac641c1efc44ea2470ecdca10eb3aa0eb31aba343fa87904b842e1f6d59d17ef37361e5a2cce750a06300aae7d8a8a832cb91196d2940a38fee470229517756c0ee0b7328ce107577a278bd4483fd7259497b4b8e6deaa4d049391297ec0ab776144ba9b7d9b4f0e43de0527ae5b16efbec71fe8219d34d4a5f8b431e3467ba9a2b308c91572dbf5dcf02eccbc7eab77ef6b2b96f3f2449dd2b869e3ec04e67"}}) foo$fmt4(&(0x7f0000000100)) foo$fmt0(&(0x7f0000000140)=0x9) mutate_array2(&(0x7f0000000180)=[{0x5}, {0xfe}]) test$length21(&(0x7f00000001c0)=0x53f4, 0x40) test$hint_data(&(0x7f0000000200)="e30e7deeda0a65eb519677cf24b25d43b4bfbe35667c33d1aecdbaff0f84318309a6f446b745348f7d541b01984197aafa0ce924687fd609420f0705c8563de2e86f41348778e045a4b0137584ba10653be5fcad1122807776e5e3f571967c9df593d27a95dc4f6ee1dc75b95d13b237dfe3f165812f28c3530b2404f2977bcfee834db02336f4f5c968417d11b4563fea1882a0693c475da6a44f1cbcaf9c1f105783") test_length15(0x5, 0x2) mutate_integer2(0x1, 0x7, 0x100, 0x3, 0x7) test$length25(&(0x7f00000002c0)=["c6578d6248c89125ed1b60a204647b0d09a01814cca5181f20ff878f0121e7e314a14bea6e26eb7e24a0bb49b88db47020b617fa17d2720eb848d5687aca427d4fba374c0f344936f4f350ab576134a78c465fc3f4179c65d2a99aca52f2ed3a5e781e8189a586ef65e80303070d5e4798aec408fa63fcc15cb9aee5b8d89adc83284966d7db4f4f2b3ddb4064a7b85cb53f6e16c8fd04f35355fceab16ead62a9395c95a0ad50745ba84b1d2ee66cc989daa977b8ab7a4546a5a20945", "01a6952f453c7471d83b04963251684b55417195bbc69af1cd93e2d5c3bc768d2e9092723c26c369a5b1a77b341384233daab7037e0f3227a6070f148de36e5652bb6887b92be7c1459c5a9d4a56f24352160fd2d9f1b5b335f63654733af16e33831eecc1cca55908045ddfd909e7d356df0012496d88f939c9842bfe67ecf56f0a4ce6a38c6e00316c874bc13441b5f9fb466df0bb4e5993142079efe917b09b1d8b78c08d3f78af1cf63efe49e83721d7e7b0003637034b79bfb488596eb0ff6e4e6b919a2c4968e994b1989087e33dc091a538", "413aa1c1b4ab651704fc1175fda37d4530d5a12010fbf9369f306b4f2ea34ce5e2dff2afc34cb5707d16c396c4cddf3782838755aca8d19cb1b7ea15d764ccb555b77deb170cb60c79b090266d43cde81a684378c5cb3453f22b232365edd20312d7868e1c349126375b1c8da969ff3e5aeafa133419807bea25413fb537dd62dbb60f049c1b5b0a48833c2e9272422dfd10dc9a857130e98d8d44daa1e24420b69d838d898b549f5ebfc944a21c3070001b06543e48dd64e76feb504eff545d93b857f999ba0714fe7b5089a8b5b84c7346ae74c37e536424b93c359f4466a55f", "a385401f31cb4cc322d11f2622b627ec35086d160eded1b5854983630c3b01b1befc2b62d20432f8f7ddb56d8a18352ef26c0c0d99be91427039f1bb19aa037f3ceb62eee770fea88ad1b848d3d547c7f5b2cb5a13b715c5879ebe31dcf9df3d363b65806c7834e0337cae3f1b0480f4592c7bb36f692feffe3d3640d1dc6dbe40627739e2b69c657fb9059a22776e7fd2ab4b1bfdefc035c60561157a83a18f9c1c798d567d90bb7084f2ac4f3b16"], 0x4) test$length20(&(0x7f0000000600)={{{0x4, 0x4, 0x7, 0x9}, 0x7, 0x7, 0x9}, 0x9, 0x9}) syz_compare(&(0x7f0000000000)='\x00', 0x1, &(0x7f0000000040)=@arr16be=[0x1, 0xfff, 0x6e, 0x1, 0x4, 0x1, 0x8001], 0xe) syz_compare_int$2(0x2, 0x3f, 0x7) syz_errno(0x2) syz_execute_func(&(0x7f0000000080)="a32f13f544efac4b66158b2262996b6b82697c03e8fd6fc298a7d828f76be9bfad63f68f7c8f27f388ab4cd56b3fa7205b7f") syz_exit(0x7ff) syz_mmap(&(0x7f0000ffd000/0x2000)=nil, 0x2000) syz_sleep_ms(0x1f) csource_test.go:124: 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 static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } 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 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 { pthread_mutex_t mu; pthread_cond_t cv; int state; } event_t; static void event_init(event_t* ev) { if (pthread_mutex_init(&ev->mu, 0)) exit(1); if (pthread_cond_init(&ev->cv, 0)) exit(1); ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { pthread_mutex_lock(&ev->mu); if (ev->state) exit(1); ev->state = 1; pthread_mutex_unlock(&ev->mu); pthread_cond_broadcast(&ev->cv); } static void event_wait(event_t* ev) { pthread_mutex_lock(&ev->mu); while (!ev->state) pthread_cond_wait(&ev->cv, &ev->mu); pthread_mutex_unlock(&ev->mu); } static int event_isset(event_t* ev) { pthread_mutex_lock(&ev->mu); int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; pthread_mutex_lock(&ev->mu); for (;;) { if (ev->state) break; uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); now = current_time_ms(); if (now - start > timeout) break; } int res = ev->state; pthread_mutex_unlock(&ev->mu); return res; } struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static long syz_mmap(volatile long a0, volatile long a1) { return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); } static long syz_errno(volatile long v) { errno = v; return v == 0 ? 0 : -1; } static long syz_exit(volatile long status) { _exit(status); return 0; } static long syz_sleep_ms(volatile long ms) { sleep_ms(ms); return 0; } static long syz_compare(volatile long want, volatile long want_len, volatile long got, volatile long got_len) { if (want_len != got_len) { errno = EBADF; goto error; } if (memcmp((void*)want, (void*)got, want_len)) { errno = EINVAL; goto error; } return 0; error: return -1; } static long syz_compare_int(volatile long n, ...) { va_list args; va_start(args, n); long v0 = va_arg(args, long); long v1 = va_arg(args, long); long v2 = va_arg(args, long); long v3 = va_arg(args, long); va_end(args); if (n < 2 || n > 4) return errno = E2BIG, -1; if (n <= 2 && v2 != 0) return errno = EFAULT, -1; if (n <= 3 && v3 != 0) return errno = EFAULT, -1; if (v0 != v1) return errno = EINVAL, -1; if (n > 2 && v0 != v2) return errno = EINVAL, -1; if (n > 3 && v0 != v3) return errno = EINVAL, -1; return 0; } static void loop(); static int do_sandbox_none(void) { loop(); return 0; } 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); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } } } #ifndef SYS_foo #define SYS_foo 0 #endif #ifndef SYS_mutate_array2 #define SYS_mutate_array2 0 #endif #ifndef SYS_mutate_integer2 #define SYS_mutate_integer2 0 #endif #ifndef SYS_test #define SYS_test 0 #endif #ifndef SYS_test_length15 #define SYS_test_length15 0 #endif void execute_call(int call) { switch (call) { case 0: memcpy((void*)0x20000000, "\x00\x03\xc9\xfb\x10\x3f\x94\x42\x85\xaf\x6b\xd6\xb1\xd2\xd2\x85", 16); memcpy((void*)0x20000010, "\xf7\x95\xa6\xc7\xd7\x4a\xf7\x37\x90\x51\x31\x34\xa2\xa4\xda\x33", 16); *(uint16_t*)0x20000020 = 0; memcpy((void*)0x20000022, "\x4f\xf2\xd0\xd3\xde\x86\x05\xcd\x78\x3b\xcb\x2d\x9b\x66\x02\xcd\x32\xba\x97\x0b\x3a\x69\x40\xb9\x2d\x0e\xb5\xd7\xa2\xca\x93\xc7\x45\xf8\x15\x1e\xe1\x4f\xfd\x20\x6f\xe3\x6a\x2a\xc6\x41\xc1\xef\xc4\x4e\xa2\x47\x0e\xcd\xca\x10\xeb\x3a\xa0\xeb\x31\xab\xa3\x43\xfa\x87\x90\x4b\x84\x2e\x1f\x6d\x59\xd1\x7e\xf3\x73\x61\xe5\xa2\xcc\xe7\x50\xa0\x63\x00\xaa\xe7\xd8\xa8\xa8\x32\xcb\x91\x19\x6d\x29\x40\xa3\x8f\xee\x47\x02\x29\x51\x77\x56\xc0\xee\x0b\x73\x28\xce\x10\x75\x77\xa2\x78\xbd\x44\x83\xfd\x72\x59\x49\x7b\x4b\x8e\x6d\xea\xa4\xd0\x49\x39\x12\x97\xec\x0a\xb7\x76\x14\x4b\xa9\xb7\xd9\xb4\xf0\xe4\x3d\xe0\x52\x7a\xe5\xb1\x6e\xfb\xec\x71\xfe\x82\x19\xd3\x4d\x4a\x5f\x8b\x43\x1e\x34\x67\xba\x9a\x2b\x30\x8c\x91\x57\x2d\xbf\x5d\xcf\x02\xec\xcb\xc7\xea\xb7\x7e\xf6\xb2\xb9\x6f\x3f\x24\x49\xdd\x2b\x86\x9e\x3e\xc0\x4e\x67", 203); struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000000, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000010, 16); uint32_t csum_1_chunk_2 = 0xcd000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x3a000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000020, 205); *(uint16_t*)0x20000020 = csum_inet_digest(&csum_1); syscall(SYS_test, 0x20000000, 0, 0, 0, 0, 0); break; case 1: sprintf((char*)0x20000100, "%020llu", (long long)0); syscall(SYS_foo, 0x20000100, 0); break; case 2: sprintf((char*)0x20000140, "%020llu", (long long)9); syscall(SYS_foo, 0x20000140, 0); break; case 3: *(uint8_t*)0x20000180 = 5; *(uint8_t*)0x20000181 = 0xfe; syscall(SYS_mutate_array2, 0x20000180); break; case 4: *(uint64_t*)0x200001c0 = 0x53f4; syscall(SYS_test, 0x200001c0, 0x40, 0, 0, 0, 0); break; case 5: memcpy((void*)0x20000200, "\xe3\x0e\x7d\xee\xda\x0a\x65\xeb\x51\x96\x77\xcf\x24\xb2\x5d\x43\xb4\xbf\xbe\x35\x66\x7c\x33\xd1\xae\xcd\xba\xff\x0f\x84\x31\x83\x09\xa6\xf4\x46\xb7\x45\x34\x8f\x7d\x54\x1b\x01\x98\x41\x97\xaa\xfa\x0c\xe9\x24\x68\x7f\xd6\x09\x42\x0f\x07\x05\xc8\x56\x3d\xe2\xe8\x6f\x41\x34\x87\x78\xe0\x45\xa4\xb0\x13\x75\x84\xba\x10\x65\x3b\xe5\xfc\xad\x11\x22\x80\x77\x76\xe5\xe3\xf5\x71\x96\x7c\x9d\xf5\x93\xd2\x7a\x95\xdc\x4f\x6e\xe1\xdc\x75\xb9\x5d\x13\xb2\x37\xdf\xe3\xf1\x65\x81\x2f\x28\xc3\x53\x0b\x24\x04\xf2\x97\x7b\xcf\xee\x83\x4d\xb0\x23\x36\xf4\xf5\xc9\x68\x41\x7d\x11\xb4\x56\x3f\xea\x18\x82\xa0\x69\x3c\x47\x5d\xa6\xa4\x4f\x1c\xbc\xaf\x9c\x1f\x10\x57\x83", 163); syscall(SYS_test, 0x20000200, 0, 0, 0, 0, 0); break; case 6: syscall(SYS_test_length15, 5, 2); break; case 7: syscall(SYS_mutate_integer2, 1ull, 7ull, 0x100, 3, 7); break; case 8: memcpy((void*)0x200002c0, "\xc6\x57\x8d\x62\x48\xc8\x91\x25\xed\x1b\x60\xa2\x04\x64\x7b\x0d\x09\xa0\x18\x14\xcc\xa5\x18\x1f\x20\xff\x87\x8f\x01\x21\xe7\xe3\x14\xa1\x4b\xea\x6e\x26\xeb\x7e\x24\xa0\xbb\x49\xb8\x8d\xb4\x70\x20\xb6\x17\xfa\x17\xd2\x72\x0e\xb8\x48\xd5\x68\x7a\xca\x42\x7d\x4f\xba\x37\x4c\x0f\x34\x49\x36\xf4\xf3\x50\xab\x57\x61\x34\xa7\x8c\x46\x5f\xc3\xf4\x17\x9c\x65\xd2\xa9\x9a\xca\x52\xf2\xed\x3a\x5e\x78\x1e\x81\x89\xa5\x86\xef\x65\xe8\x03\x03\x07\x0d\x5e\x47\x98\xae\xc4\x08\xfa\x63\xfc\xc1\x5c\xb9\xae\xe5\xb8\xd8\x9a\xdc\x83\x28\x49\x66\xd7\xdb\x4f\x4f\x2b\x3d\xdb\x40\x64\xa7\xb8\x5c\xb5\x3f\x6e\x16\xc8\xfd\x04\xf3\x53\x55\xfc\xea\xb1\x6e\xad\x62\xa9\x39\x5c\x95\xa0\xad\x50\x74\x5b\xa8\x4b\x1d\x2e\xe6\x6c\xc9\x89\xda\xa9\x77\xb8\xab\x7a\x45\x46\xa5\xa2\x09\x45", 189); memcpy((void*)0x2000037d, "\x01\xa6\x95\x2f\x45\x3c\x74\x71\xd8\x3b\x04\x96\x32\x51\x68\x4b\x55\x41\x71\x95\xbb\xc6\x9a\xf1\xcd\x93\xe2\xd5\xc3\xbc\x76\x8d\x2e\x90\x92\x72\x3c\x26\xc3\x69\xa5\xb1\xa7\x7b\x34\x13\x84\x23\x3d\xaa\xb7\x03\x7e\x0f\x32\x27\xa6\x07\x0f\x14\x8d\xe3\x6e\x56\x52\xbb\x68\x87\xb9\x2b\xe7\xc1\x45\x9c\x5a\x9d\x4a\x56\xf2\x43\x52\x16\x0f\xd2\xd9\xf1\xb5\xb3\x35\xf6\x36\x54\x73\x3a\xf1\x6e\x33\x83\x1e\xec\xc1\xcc\xa5\x59\x08\x04\x5d\xdf\xd9\x09\xe7\xd3\x56\xdf\x00\x12\x49\x6d\x88\xf9\x39\xc9\x84\x2b\xfe\x67\xec\xf5\x6f\x0a\x4c\xe6\xa3\x8c\x6e\x00\x31\x6c\x87\x4b\xc1\x34\x41\xb5\xf9\xfb\x46\x6d\xf0\xbb\x4e\x59\x93\x14\x20\x79\xef\xe9\x17\xb0\x9b\x1d\x8b\x78\xc0\x8d\x3f\x78\xaf\x1c\xf6\x3e\xfe\x49\xe8\x37\x21\xd7\xe7\xb0\x00\x36\x37\x03\x4b\x79\xbf\xb4\x88\x59\x6e\xb0\xff\x6e\x4e\x6b\x91\x9a\x2c\x49\x68\xe9\x94\xb1\x98\x90\x87\xe3\x3d\xc0\x91\xa5\x38", 213); memcpy((void*)0x20000452, "\x41\x3a\xa1\xc1\xb4\xab\x65\x17\x04\xfc\x11\x75\xfd\xa3\x7d\x45\x30\xd5\xa1\x20\x10\xfb\xf9\x36\x9f\x30\x6b\x4f\x2e\xa3\x4c\xe5\xe2\xdf\xf2\xaf\xc3\x4c\xb5\x70\x7d\x16\xc3\x96\xc4\xcd\xdf\x37\x82\x83\x87\x55\xac\xa8\xd1\x9c\xb1\xb7\xea\x15\xd7\x64\xcc\xb5\x55\xb7\x7d\xeb\x17\x0c\xb6\x0c\x79\xb0\x90\x26\x6d\x43\xcd\xe8\x1a\x68\x43\x78\xc5\xcb\x34\x53\xf2\x2b\x23\x23\x65\xed\xd2\x03\x12\xd7\x86\x8e\x1c\x34\x91\x26\x37\x5b\x1c\x8d\xa9\x69\xff\x3e\x5a\xea\xfa\x13\x34\x19\x80\x7b\xea\x25\x41\x3f\xb5\x37\xdd\x62\xdb\xb6\x0f\x04\x9c\x1b\x5b\x0a\x48\x83\x3c\x2e\x92\x72\x42\x2d\xfd\x10\xdc\x9a\x85\x71\x30\xe9\x8d\x8d\x44\xda\xa1\xe2\x44\x20\xb6\x9d\x83\x8d\x89\x8b\x54\x9f\x5e\xbf\xc9\x44\xa2\x1c\x30\x70\x00\x1b\x06\x54\x3e\x48\xdd\x64\xe7\x6f\xeb\x50\x4e\xff\x54\x5d\x93\xb8\x57\xf9\x99\xba\x07\x14\xfe\x7b\x50\x89\xa8\xb5\xb8\x4c\x73\x46\xae\x74\xc3\x7e\x53\x64\x24\xb9\x3c\x35\x9f\x44\x66\xa5\x5f", 225); memcpy((void*)0x20000533, "\xa3\x85\x40\x1f\x31\xcb\x4c\xc3\x22\xd1\x1f\x26\x22\xb6\x27\xec\x35\x08\x6d\x16\x0e\xde\xd1\xb5\x85\x49\x83\x63\x0c\x3b\x01\xb1\xbe\xfc\x2b\x62\xd2\x04\x32\xf8\xf7\xdd\xb5\x6d\x8a\x18\x35\x2e\xf2\x6c\x0c\x0d\x99\xbe\x91\x42\x70\x39\xf1\xbb\x19\xaa\x03\x7f\x3c\xeb\x62\xee\xe7\x70\xfe\xa8\x8a\xd1\xb8\x48\xd3\xd5\x47\xc7\xf5\xb2\xcb\x5a\x13\xb7\x15\xc5\x87\x9e\xbe\x31\xdc\xf9\xdf\x3d\x36\x3b\x65\x80\x6c\x78\x34\xe0\x33\x7c\xae\x3f\x1b\x04\x80\xf4\x59\x2c\x7b\xb3\x6f\x69\x2f\xef\xfe\x3d\x36\x40\xd1\xdc\x6d\xbe\x40\x62\x77\x39\xe2\xb6\x9c\x65\x7f\xb9\x05\x9a\x22\x77\x6e\x7f\xd2\xab\x4b\x1b\xfd\xef\xc0\x35\xc6\x05\x61\x15\x7a\x83\xa1\x8f\x9c\x1c\x79\x8d\x56\x7d\x90\xbb\x70\x84\xf2\xac\x4f\x3b\x16", 175); syscall(SYS_test, 0x200002c0, 4, 0, 0, 0, 0); break; case 9: *(uint8_t*)0x20000600 = 4; *(uint8_t*)0x20000601 = 4; *(uint8_t*)0x20000602 = 7; *(uint8_t*)0x20000603 = 9; *(uint8_t*)0x20000604 = 7; *(uint8_t*)0x20000605 = 7; *(uint8_t*)0x20000606 = 9; *(uint8_t*)0x20000607 = 9; *(uint8_t*)0x20000608 = 9; syscall(SYS_test, 0x20000600, 0, 0, 0, 0, 0); break; case 10: memcpy((void*)0x20000000, "\000", 1); *(uint16_t*)0x20000040 = htobe16(1); *(uint16_t*)0x20000042 = htobe16(0xfff); *(uint16_t*)0x20000044 = htobe16(0x6e); *(uint16_t*)0x20000046 = htobe16(1); *(uint16_t*)0x20000048 = htobe16(4); *(uint16_t*)0x2000004a = htobe16(1); *(uint16_t*)0x2000004c = htobe16(0x8001); syz_compare(0x20000000, 1, 0x20000040, 0xe); break; case 11: syz_compare_int(2, 0x3f, 7, 0, 0); break; case 12: syz_errno(2); break; case 13: memcpy((void*)0x20000080, "\xa3\x2f\x13\xf5\x44\xef\xac\x4b\x66\x15\x8b\x22\x62\x99\x6b\x6b\x82\x69\x7c\x03\xe8\xfd\x6f\xc2\x98\xa7\xd8\x28\xf7\x6b\xe9\xbf\xad\x63\xf6\x8f\x7c\x8f\x27\xf3\x88\xab\x4c\xd5\x6b\x3f\xa7\x20\x5b\x7f", 50); syz_execute_func(0x20000080); break; case 14: syz_exit(0x7ff); break; case 15: syz_mmap(0x20ffd000, 0x2000); break; case 16: syz_sleep_ms(0x1f); break; } } int main(void) { syz_mmap(0x20000000, 0x1000000); do_sandbox_none(); return 0; } compiler invocation: gcc [-o /tmp/syz-executor036400470 -DGOOS_test=1 -DGOARCH_32_fork_shmem=1 -DHOSTGOOS_linux=1 -x c - -m32 -static -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-overflow] FAIL FAIL github.com/google/syzkaller/pkg/csource 98.073s ok github.com/google/syzkaller/pkg/db (cached) ok github.com/google/syzkaller/pkg/email (cached) ? 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] ok github.com/google/syzkaller/pkg/host 37.739s ? github.com/google/syzkaller/pkg/html [no test files] ok github.com/google/syzkaller/pkg/ifuzz (cached) ? github.com/google/syzkaller/pkg/ifuzz/gen [no test files] ? github.com/google/syzkaller/pkg/ifuzz/generated [no test files] ok github.com/google/syzkaller/pkg/instance 6.227s ok github.com/google/syzkaller/pkg/ipc 18.750s ? github.com/google/syzkaller/pkg/ipc/ipcconfig [no test files] ? github.com/google/syzkaller/pkg/kcidb [no test files] 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) ? github.com/google/syzkaller/pkg/rpctype [no test files] ok github.com/google/syzkaller/pkg/runtest 103.216s ok github.com/google/syzkaller/pkg/serializer (cached) ? github.com/google/syzkaller/pkg/signal [no test files] ok github.com/google/syzkaller/pkg/symbolizer 0.536s ok github.com/google/syzkaller/pkg/vcs 26.513s ok github.com/google/syzkaller/prog (cached) ok github.com/google/syzkaller/prog/test (cached) ? github.com/google/syzkaller/sys [no test files] ? github.com/google/syzkaller/sys/akaros [no test files] ? github.com/google/syzkaller/sys/akaros/gen [no test files] ? github.com/google/syzkaller/sys/freebsd [no test files] ? github.com/google/syzkaller/sys/freebsd/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia [no test files] ? github.com/google/syzkaller/sys/fuchsia/fidlgen [no test files] ? github.com/google/syzkaller/sys/fuchsia/gen [no test files] ? github.com/google/syzkaller/sys/fuchsia/layout [no test files] ok github.com/google/syzkaller/sys/linux (cached) ? github.com/google/syzkaller/sys/linux/gen [no test files] ? github.com/google/syzkaller/sys/netbsd [no test files] ? github.com/google/syzkaller/sys/netbsd/gen [no test files] ok github.com/google/syzkaller/sys/openbsd (cached) ? 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/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) ? github.com/google/syzkaller/syz-manager [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-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-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] ok github.com/google/syzkaller/tools/syz-linter 5.075s ? github.com/google/syzkaller/tools/syz-make [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-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-testbuild [no test files] ? github.com/google/syzkaller/tools/syz-trace2syz [no test files] ok github.com/google/syzkaller/tools/syz-trace2syz/parser (cached) ok github.com/google/syzkaller/tools/syz-trace2syz/proggen (cached) ? 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] ok github.com/google/syzkaller/vm (cached) ? github.com/google/syzkaller/vm/adb [no test files] ? github.com/google/syzkaller/vm/bhyve [no test files] ? github.com/google/syzkaller/vm/gce [no test files] ? github.com/google/syzkaller/vm/gvisor [no test files] ok github.com/google/syzkaller/vm/isolated (cached) ? github.com/google/syzkaller/vm/kvm [no test files] ? github.com/google/syzkaller/vm/odroid [no test files] ? github.com/google/syzkaller/vm/qemu [no test files] ok github.com/google/syzkaller/vm/vmimpl (cached) ? github.com/google/syzkaller/vm/vmm [no test files] ? github.com/google/syzkaller/vm/vmware [no test files] FAIL