// https://syzkaller.appspot.com/bug?id=21cfee420f987629e5cef6076b81482de2f663a8 // 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; } } } } #ifndef __NR_sendmmsg #define __NR_sendmmsg 345 #endif #ifndef __NR_mmap #define __NR_mmap 192 #endif #ifndef __NR_socket #define __NR_socket 359 #endif #ifndef __NR_connect #define __NR_connect 362 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 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); *(uint32_t*)0x20bfcf4c = 0x20e79ff0; *(uint32_t*)0x20bfcf50 = 0x10; *(uint32_t*)0x20bfcf54 = 0x20898000; *(uint32_t*)0x20bfcf58 = 1; *(uint32_t*)0x20bfcf5c = 0x20e79000; *(uint32_t*)0x20bfcf60 = 0; *(uint32_t*)0x20bfcf64 = 0x20004800; *(uint32_t*)0x20bfcf68 = -1; *(uint32_t*)0x20bfcf6c = 0x20e79ff0; *(uint32_t*)0x20bfcf70 = 0x10; *(uint32_t*)0x20bfcf74 = 0x20e79000; *(uint32_t*)0x20bfcf78 = 1; *(uint32_t*)0x20bfcf7c = 0x20e79e60; *(uint32_t*)0x20bfcf80 = 0x30; *(uint32_t*)0x20bfcf84 = 0x20000041; *(uint32_t*)0x20bfcf88 = 0xe587; *(uint32_t*)0x20bfcf8c = 0x205f1fe0; *(uint32_t*)0x20bfcf90 = 0x20; *(uint32_t*)0x20bfcf94 = 0x20c51fc0; *(uint32_t*)0x20bfcf98 = 4; *(uint32_t*)0x20bfcf9c = 0x20993e80; *(uint32_t*)0x20bfcfa0 = 0x40; *(uint32_t*)0x20bfcfa4 = 0; *(uint32_t*)0x20bfcfa8 = 5; *(uint16_t*)0x20e79ff0 = 0x27; *(uint32_t*)0x20e79ff4 = 0x1ff; *(uint32_t*)0x20e79ff8 = 0; *(uint32_t*)0x20e79ffc = 2; *(uint32_t*)0x20898000 = 0x20e7951b; *(uint32_t*)0x20898004 = 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; *(uint32_t*)0x20e79000 = 0x20e79f6c; *(uint32_t*)0x20e79004 = 0; *(uint32_t*)0x20e79e60 = 0x10; *(uint32_t*)0x20e79e64 = 0x1ff; *(uint32_t*)0x20e79e68 = 5; *(uint32_t*)0x20e79e6c = 0x10; *(uint32_t*)0x20e79e70 = 0; *(uint32_t*)0x20e79e74 = 3; *(uint32_t*)0x20e79e78 = 0x10; *(uint32_t*)0x20e79e7c = 0x3a; *(uint32_t*)0x20e79e80 = 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; *(uint32_t*)0x20c51fc0 = 0x20ad2000; *(uint32_t*)0x20c51fc4 = 0; *(uint32_t*)0x20c51fc8 = 0x203c6fad; *(uint32_t*)0x20c51fcc = 0; *(uint32_t*)0x20c51fd0 = 0x207def65; *(uint32_t*)0x20c51fd4 = 0; *(uint32_t*)0x20c51fd8 = 0x20e79f11; *(uint32_t*)0x20c51fdc = 0; *(uint32_t*)0x20993e80 = 0x10; *(uint32_t*)0x20993e84 = 0x11b; *(uint32_t*)0x20993e88 = 6; *(uint32_t*)0x20993e8c = 0x10; *(uint32_t*)0x20993e90 = 0; *(uint32_t*)0x20993e94 = 0xcd9c; *(uint32_t*)0x20993e98 = 0x10; *(uint32_t*)0x20993e9c = 6; *(uint32_t*)0x20993ea0 = 9; *(uint32_t*)0x20993ea4 = 0x10; *(uint32_t*)0x20993ea8 = 0x11f; *(uint32_t*)0x20993eac = 1; syscall(__NR_sendmmsg, r[0], 0x20bfcf4c, 3, 0x4000); } int main() { for (;;) { loop(); } }