// https://syzkaller.appspot.com/bug?id=5735d842f7ea3ed9220aca64952ac4aba7ba741c // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include __attribute__((noreturn)) static void doexit(int status) { volatile unsigned i; syscall(__NR_exit_group, status); for (i = 0;; i++) { } } #include #include #include #include #include #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 void use_temporary_dir() { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) fail("failed to mkdtemp"); if (chmod(tmpdir, 0777)) fail("failed to chmod"); if (chdir(tmpdir)) fail("failed to chdir"); } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void loop() { long res = 0; res = syscall(__NR_socket, 0x26, 5, 0); if (res != -1) r[0] = res; *(uint16_t*)0x20004e80 = 0x26; memcpy((void*)0x20004e82, "\x68\x61\x73\x68\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 14); *(uint32_t*)0x20004e90 = 0; *(uint32_t*)0x20004e94 = 0; memcpy((void*)0x20004e98, "\x73\x68\x61\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 64); syscall(__NR_bind, r[0], 0x20004e80, 0x58); res = syscall(__NR_accept4, r[0], 0, 0, 0); if (res != -1) r[1] = res; *(uint16_t*)0x20351ff0 = 4; *(uint16_t*)0x20351ff2 = htobe16(0); *(uint32_t*)0x20351ff4 = htobe32(0); memcpy((void*)0x20351ff8, "\xa0\x74\xed\xeb\xb7\xe1", 6); *(uint8_t*)0x20351ffe = 0; *(uint8_t*)0x20351fff = 0; syscall(__NR_sendto, r[1], 0x205c8f58, 0xfffffffffffffeee, 0, 0x20351ff0, 0x10); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); use_temporary_dir(); loop(); return 0; }