// https://syzkaller.appspot.com/bug?id=26b6cfa3b92fa8cf9ae095c108a988e73dbafab8 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #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 #include #include #include const int kFailStatus = 67; const int kRetryStatus = 69; static void exitf(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(kRetryStatus); } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } static int inject_fault(int nth) { int fd; char buf[16]; fd = open("/proc/thread-self/fail-nth", O_RDWR); if (fd == -1) exitf("failed to open /proc/thread-self/fail-nth"); sprintf(buf, "%d", nth + 1); if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) exitf("failed to write /proc/thread-self/fail-nth"); return fd; } uint64_t r[1] = {0xffffffffffffffff}; void loop() { long res = 0; res = syscall(__NR_socket, 0x10, 3, 0); if (res != -1) r[0] = res; *(uint64_t*)0x20002fc8 = 0x20000000; *(uint16_t*)0x20000000 = 0x10; *(uint16_t*)0x20000002 = 0xf000; *(uint32_t*)0x20000004 = 0; *(uint32_t*)0x20000008 = 0; *(uint32_t*)0x20002fd0 = 0x80; *(uint64_t*)0x20002fd8 = 0x200001c0; *(uint64_t*)0x200001c0 = 0x20000080; memcpy((void*)0x20000080, "\x55\x00\x00\x00\x18\x00\x7f\xbd\xb7\x2d\x1c\xb2\xa4\xa2\x80\x93\x0a" "\x06\x80\xfe\x00\xa8\x43\x08\x91\x00\x00\x00\x39\x00\x08\x00\x0a\x00" "\x05\x00\x00\x00\x00\x00\x19\x00\xa3\x07\x25\x00\x00\x00\x00\x00\xd3" "\x74\xe1\xb6\x1e\x32\xab\xd0\xa4\xdf\x57\xdb\x81\x31\x4c\x00\xdc\x13" "\x38\xd5\x44\x00\x00\x9b\x84\x13\x6e\xf7\x5a\xfb\x83\xde\x44\x8d\xaa", 85); *(uint64_t*)0x200001c8 = 0x55; *(uint64_t*)0x20002fe0 = 1; *(uint64_t*)0x20002fe8 = 0x20006000; *(uint64_t*)0x20002ff0 = 0; *(uint32_t*)0x20002ff8 = 0; write_file("/sys/kernel/debug/failslab/ignore-gfp-wait", "N"); write_file("/sys/kernel/debug/fail_futex/ignore-private", "N"); inject_fault(3); syscall(__NR_sendmsg, r[0], 0x20002fc8, 0); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }