// https://syzkaller.appspot.com/bug?id=13abcb2c9eea7e408f8e25d3a9ae401754723024 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include __attribute__((noreturn)) static void doexit(int status) { volatile unsigned i; syscall(__NR_exit_group, status); for (i = 0;; i++) { } } #include #include const int kFailStatus = 67; const int kRetryStatus = 69; static void fail(const char* msg, ...) { int e = errno; va_list args; va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); fprintf(stderr, " (errno %d)\n", e); doexit((e == ENOMEM || e == EAGAIN) ? kRetryStatus : kFailStatus); } static uint64_t current_time_ms() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) fail("clock_gettime failed"); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void test(); void loop() { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) fail("loop fork failed"); if (pid == 0) { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); test(); doexit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { int res = waitpid(-1, &status, __WALL | WNOHANG); if (res == pid) break; usleep(1000); if (current_time_ms() - start > 5 * 1000) { kill(-pid, SIGKILL); kill(pid, SIGKILL); while (waitpid(-1, &status, __WALL) != pid) { } break; } } } } long r[2]; void test() { memset(r, -1, sizeof(r)); syscall(__NR_mmap, 0x20000000, 0xe7c000, 3, 0x32, -1, 0); r[0] = syscall(__NR_socket, 0xa, 2, 0); r[1] = syscall(__NR_socket, 0x18, 1, 1); *(uint16_t*)0x20e71000 = 0x18; *(uint32_t*)0x20e71002 = 1; *(uint32_t*)0x20e71006 = 0; *(uint32_t*)0x20e7100a = r[0]; *(uint16_t*)0x20e7100e = 2; *(uint16_t*)0x20e71010 = 0; *(uint16_t*)0x20e71012 = 2; *(uint16_t*)0x20e71014 = 0; *(uint16_t*)0x20e71016 = 0xa; *(uint16_t*)0x20e71018 = htobe16(0x4e21); *(uint32_t*)0x20e7101a = 3; *(uint8_t*)0x20e7101e = -1; *(uint8_t*)0x20e7101f = 1; *(uint8_t*)0x20e71020 = 0; *(uint8_t*)0x20e71021 = 0; *(uint8_t*)0x20e71022 = 0; *(uint8_t*)0x20e71023 = 0; *(uint8_t*)0x20e71024 = 0; *(uint8_t*)0x20e71025 = 0; *(uint8_t*)0x20e71026 = 0; *(uint8_t*)0x20e71027 = 0; *(uint8_t*)0x20e71028 = 0; *(uint8_t*)0x20e71029 = 0; *(uint8_t*)0x20e7102a = 0; *(uint8_t*)0x20e7102b = 0; *(uint8_t*)0x20e7102c = 0; *(uint8_t*)0x20e7102d = 1; *(uint32_t*)0x20e7102e = 4; syscall(__NR_connect, r[1], 0x20e71000, 0x32); *(uint64_t*)0x20bfcf4c = 0x20e79ff0; *(uint32_t*)0x20bfcf54 = 0x10; *(uint64_t*)0x20bfcf5c = 0x20898000; *(uint64_t*)0x20bfcf64 = 1; *(uint64_t*)0x20bfcf6c = 0x20e79000; *(uint64_t*)0x20bfcf74 = 0; *(uint32_t*)0x20bfcf7c = 0x20004800; *(uint32_t*)0x20bfcf84 = -1; *(uint64_t*)0x20bfcf88 = 0x20e79ff0; *(uint32_t*)0x20bfcf90 = 0x10; *(uint64_t*)0x20bfcf98 = 0x20e79000; *(uint64_t*)0x20bfcfa0 = 1; *(uint64_t*)0x20bfcfa8 = 0x20e79e60; *(uint64_t*)0x20bfcfb0 = 0x30; *(uint32_t*)0x20bfcfb8 = 0x20000041; *(uint32_t*)0x20bfcfc0 = 0xe587; *(uint64_t*)0x20bfcfc4 = 0x205f1fe0; *(uint32_t*)0x20bfcfcc = 0x20; *(uint64_t*)0x20bfcfd4 = 0x20c51fc0; *(uint64_t*)0x20bfcfdc = 4; *(uint64_t*)0x20bfcfe4 = 0x20993e80; *(uint64_t*)0x20bfcfec = 0x40; *(uint32_t*)0x20bfcff4 = 0; *(uint32_t*)0x20bfcffc = 5; *(uint16_t*)0x20e79ff0 = 0x27; *(uint32_t*)0x20e79ff4 = 0x1ff; *(uint32_t*)0x20e79ff8 = 0; *(uint32_t*)0x20e79ffc = 2; *(uint64_t*)0x20898000 = 0x20e7951b; *(uint64_t*)0x20898008 = 0; *(uint16_t*)0x20e79ff0 = 4; *(uint16_t*)0x20e79ff2 = htobe16(0xf8c8); *(uint32_t*)0x20e79ff4 = htobe32(7); memcpy((void*)0x20e79ff8, "\x44\x1b\x98\xef\x2f\xc0", 6); *(uint8_t*)0x20e79ffe = 0; *(uint8_t*)0x20e79fff = 0; *(uint64_t*)0x20e79000 = 0x20e79f6c; *(uint64_t*)0x20e79008 = 0; *(uint64_t*)0x20e79e60 = 0x10; *(uint32_t*)0x20e79e68 = 0x1ff; *(uint32_t*)0x20e79e6c = 5; *(uint64_t*)0x20e79e70 = 0x10; *(uint32_t*)0x20e79e78 = 0; *(uint32_t*)0x20e79e7c = 3; *(uint64_t*)0x20e79e80 = 0x10; *(uint32_t*)0x20e79e88 = 0x3a; *(uint32_t*)0x20e79e8c = 0; *(uint16_t*)0x205f1fe0 = 0x18; *(uint32_t*)0x205f1fe2 = 2; *(uint16_t*)0x205f1fe6 = htobe16(1); *(uint8_t*)0x205f1fea = 0xac; *(uint8_t*)0x205f1feb = 0x14; *(uint8_t*)0x205f1fec = 0; *(uint8_t*)0x205f1fed = 0x12; *(uint8_t*)0x205f1fee = 0; *(uint8_t*)0x205f1fef = 0; *(uint8_t*)0x205f1ff0 = 0; *(uint8_t*)0x205f1ff1 = 0; *(uint8_t*)0x205f1ff2 = 0; *(uint8_t*)0x205f1ff3 = 0; *(uint8_t*)0x205f1ff4 = 0; *(uint8_t*)0x205f1ff5 = 0; *(uint8_t*)0x205f1ff6 = 0; *(uint8_t*)0x205f1ff7 = 0; *(uint8_t*)0x205f1ff8 = 0; *(uint8_t*)0x205f1ff9 = 0; *(uint8_t*)0x205f1ffa = 0; *(uint8_t*)0x205f1ffb = 0; *(uint8_t*)0x205f1ffc = 0; *(uint8_t*)0x205f1ffd = 0; *(uint8_t*)0x205f1ffe = 0; *(uint8_t*)0x205f1fff = 0; *(uint64_t*)0x20c51fc0 = 0x20ad2000; *(uint64_t*)0x20c51fc8 = 0; *(uint64_t*)0x20c51fd0 = 0x203c6fad; *(uint64_t*)0x20c51fd8 = 0; *(uint64_t*)0x20c51fe0 = 0x207def65; *(uint64_t*)0x20c51fe8 = 0; *(uint64_t*)0x20c51ff0 = 0x20e79f11; *(uint64_t*)0x20c51ff8 = 0; *(uint64_t*)0x20993e80 = 0x10; *(uint32_t*)0x20993e88 = 0x11b; *(uint32_t*)0x20993e8c = 6; *(uint64_t*)0x20993e90 = 0x10; *(uint32_t*)0x20993e98 = 0; *(uint32_t*)0x20993e9c = 0xcd9c; *(uint64_t*)0x20993ea0 = 0x10; *(uint32_t*)0x20993ea8 = 6; *(uint32_t*)0x20993eac = 9; *(uint64_t*)0x20993eb0 = 0x10; *(uint32_t*)0x20993eb8 = 0x11f; *(uint32_t*)0x20993ebc = 1; syscall(__NR_sendmmsg, r[0], 0x20bfcf4c, 3, 0x4000); } int main() { for (;;) { loop(); } }