// https://syzkaller.appspot.com/bug?id=a11cf051e0660beba5fb039428c8a133b4f75030 // 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 #include #include unsigned long long procid; 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 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 void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); int i; for (i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); 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; } } } uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; res = syscall(__NR_socket, 2ul, 1ul, 0ul); if (res != -1) r[0] = res; memcpy((void*)0x20000540, "raw\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000", 32); *(uint32_t*)0x20000560 = 2; *(uint32_t*)0x20000564 = 3; *(uint32_t*)0x20000568 = 0x2b8; *(uint32_t*)0x2000056c = 0x128; *(uint32_t*)0x20000570 = 0; *(uint32_t*)0x20000574 = 0; *(uint32_t*)0x20000578 = 0; *(uint32_t*)0x2000057c = 0x128; *(uint32_t*)0x20000580 = 0x220; *(uint32_t*)0x20000584 = 0x220; *(uint32_t*)0x20000588 = 0x220; *(uint32_t*)0x2000058c = 0x220; *(uint32_t*)0x20000590 = 0x220; *(uint32_t*)0x20000594 = 3; *(uint64_t*)0x20000598 = 0; *(uint32_t*)0x200005a0 = htobe32(0); *(uint32_t*)0x200005a4 = htobe32(-1); *(uint32_t*)0x200005a8 = htobe32(0); *(uint32_t*)0x200005ac = htobe32(0); memcpy((void*)0x200005b0, "macvlan1\000\000\000\000\000\000\000\000", 16); memcpy((void*)0x200005c0, "sit0\000\000\000\000\000\000\000\000\000\000\000\000", 16); *(uint8_t*)0x200005d0 = 0; *(uint8_t*)0x200005e0 = 0; *(uint16_t*)0x200005f0 = 0; *(uint8_t*)0x200005f2 = 0; *(uint8_t*)0x200005f3 = 0; *(uint32_t*)0x200005f4 = 0; *(uint16_t*)0x200005f8 = 0xc8; *(uint16_t*)0x200005fa = 0x128; *(uint32_t*)0x200005fc = 0; *(uint64_t*)0x20000600 = 0; *(uint64_t*)0x20000608 = 0; *(uint16_t*)0x20000610 = 0x58; memcpy((void*)0x20000612, "hashlimit\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000", 29); *(uint8_t*)0x2000062f = 1; memcpy((void*)0x20000630, "vxcan1\000\000\000\000\000\000\000\000\000\000", 16); *(uint32_t*)0x20000640 = 0; *(uint32_t*)0x20000644 = 0; *(uint32_t*)0x20000648 = 0x200; *(uint32_t*)0x2000064c = 0x12020000; *(uint32_t*)0x20000650 = 0; *(uint32_t*)0x20000654 = 1; *(uint32_t*)0x20000658 = 9; *(uint8_t*)0x2000065c = 0; *(uint8_t*)0x2000065d = 0; *(uint64_t*)0x20000660 = 0; *(uint16_t*)0x20000668 = 0x60; memcpy((void*)0x2000066a, "HMARK\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000" "\000", 29); *(uint8_t*)0x20000687 = 0; *(uint64_t*)0x20000688 = htobe64(0); *(uint64_t*)0x20000690 = htobe64(1); *(uint32_t*)0x20000698 = htobe32(0); *(uint32_t*)0x2000069c = htobe32(0); *(uint32_t*)0x200006a0 = htobe32(0); *(uint32_t*)0x200006a4 = htobe32(0); *(uint16_t*)0x200006a8 = htobe16(0); *(uint16_t*)0x200006aa = htobe16(0); *(uint16_t*)0x200006ac = htobe16(0); *(uint16_t*)0x200006ae = htobe16(0); *(uint32_t*)0x200006b0 = 0; *(uint16_t*)0x200006b4 = 0; *(uint32_t*)0x200006b8 = 0; *(uint32_t*)0x200006bc = 0; *(uint32_t*)0x200006c0 = 0; *(uint8_t*)0x200006c8 = 0; *(uint8_t*)0x200006c9 = 0; *(uint8_t*)0x200006ca = 0; *(uint8_t*)0x200006cb = 0; *(uint8_t*)0x200006cc = 0; *(uint8_t*)0x200006cd = 0; *(uint8_t*)0x200006ce = 0; *(uint8_t*)0x200006cf = 0; *(uint8_t*)0x200006d0 = 0; *(uint8_t*)0x200006d1 = 0; *(uint8_t*)0x200006d2 = 0; *(uint8_t*)0x200006d3 = 0; *(uint8_t*)0x200006d4 = 0; *(uint8_t*)0x200006d5 = 0; *(uint8_t*)0x200006d6 = 0; *(uint8_t*)0x200006d7 = 0; *(uint8_t*)0x200006d8 = 0; *(uint8_t*)0x200006d9 = 0; *(uint8_t*)0x200006da = 0; *(uint8_t*)0x200006db = 0; *(uint8_t*)0x200006dc = 0; *(uint8_t*)0x200006dd = 0; *(uint8_t*)0x200006de = 0; *(uint8_t*)0x200006df = 0; *(uint8_t*)0x200006e0 = 0; *(uint8_t*)0x200006e1 = 0; *(uint8_t*)0x200006e2 = 0; *(uint8_t*)0x200006e3 = 0; *(uint8_t*)0x200006e4 = 0; *(uint8_t*)0x200006e5 = 0; *(uint8_t*)0x200006e6 = 0; *(uint8_t*)0x200006e7 = 0; *(uint8_t*)0x200006e8 = 0; *(uint8_t*)0x200006e9 = 0; *(uint8_t*)0x200006ea = 0; *(uint8_t*)0x200006eb = 0; *(uint8_t*)0x200006ec = 0; *(uint8_t*)0x200006ed = 0; *(uint8_t*)0x200006ee = 0; *(uint8_t*)0x200006ef = 0; *(uint8_t*)0x200006f0 = 0; *(uint8_t*)0x200006f1 = 0; *(uint8_t*)0x200006f2 = 0; *(uint8_t*)0x200006f3 = 0; *(uint8_t*)0x200006f4 = 0; *(uint8_t*)0x200006f5 = 0; *(uint8_t*)0x200006f6 = 0; *(uint8_t*)0x200006f7 = 0; *(uint8_t*)0x200006f8 = 0; *(uint8_t*)0x200006f9 = 0; *(uint8_t*)0x200006fa = 0; *(uint8_t*)0x200006fb = 0; *(uint8_t*)0x200006fc = 0; *(uint8_t*)0x200006fd = 0; *(uint8_t*)0x200006fe = 0; *(uint8_t*)0x200006ff = 0; *(uint8_t*)0x20000700 = 0; *(uint8_t*)0x20000701 = 0; *(uint8_t*)0x20000702 = 0; *(uint8_t*)0x20000703 = 0; *(uint8_t*)0x20000704 = 0; *(uint8_t*)0x20000705 = 0; *(uint8_t*)0x20000706 = 0; *(uint8_t*)0x20000707 = 0; *(uint8_t*)0x20000708 = 0; *(uint8_t*)0x20000709 = 0; *(uint8_t*)0x2000070a = 0; *(uint8_t*)0x2000070b = 0; *(uint8_t*)0x2000070c = 0; *(uint8_t*)0x2000070d = 0; *(uint8_t*)0x2000070e = 0; *(uint8_t*)0x2000070f = 0; *(uint8_t*)0x20000710 = 0; *(uint8_t*)0x20000711 = 0; *(uint8_t*)0x20000712 = 0; *(uint8_t*)0x20000713 = 0; *(uint8_t*)0x20000714 = 0; *(uint8_t*)0x20000715 = 0; *(uint8_t*)0x20000716 = 0; *(uint8_t*)0x20000717 = 0; *(uint8_t*)0x20000718 = 0; *(uint8_t*)0x20000719 = 0; *(uint8_t*)0x2000071a = 0; *(uint8_t*)0x2000071b = 0; *(uint32_t*)0x2000071c = 0; *(uint16_t*)0x20000720 = 0x98; *(uint16_t*)0x20000722 = 0xf8; *(uint32_t*)0x20000724 = 0; *(uint64_t*)0x20000728 = 0; *(uint64_t*)0x20000730 = 0; *(uint16_t*)0x20000738 = 0x28; memcpy((void*)0x2000073a, "rpfilter\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000", 29); *(uint8_t*)0x20000757 = 0; *(uint8_t*)0x20000758 = 0; *(uint16_t*)0x20000760 = 0x60; memcpy((void*)0x20000762, "SET\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000", 29); *(uint8_t*)0x2000077f = 0; *(uint16_t*)0x20000780 = 0; *(uint32_t*)0x20000784 = 0; *(uint32_t*)0x20000788 = 0; *(uint32_t*)0x2000078c = 0; *(uint32_t*)0x20000790 = 0; *(uint32_t*)0x20000794 = 0; *(uint32_t*)0x20000798 = 0; *(uint8_t*)0x2000079c = 0; *(uint8_t*)0x2000079d = 0; *(uint16_t*)0x200007a0 = 0; *(uint32_t*)0x200007a4 = 0; *(uint32_t*)0x200007a8 = 0; *(uint32_t*)0x200007ac = 0; *(uint32_t*)0x200007b0 = 0; *(uint32_t*)0x200007b4 = 0; *(uint32_t*)0x200007b8 = 0; *(uint8_t*)0x200007bc = 0; *(uint8_t*)0x200007bd = 0; *(uint8_t*)0x200007c0 = 0; *(uint8_t*)0x200007c1 = 0; *(uint8_t*)0x200007c2 = 0; *(uint8_t*)0x200007c3 = 0; *(uint8_t*)0x200007c4 = 0; *(uint8_t*)0x200007c5 = 0; *(uint8_t*)0x200007c6 = 0; *(uint8_t*)0x200007c7 = 0; *(uint8_t*)0x200007c8 = 0; *(uint8_t*)0x200007c9 = 0; *(uint8_t*)0x200007ca = 0; *(uint8_t*)0x200007cb = 0; *(uint8_t*)0x200007cc = 0; *(uint8_t*)0x200007cd = 0; *(uint8_t*)0x200007ce = 0; *(uint8_t*)0x200007cf = 0; *(uint8_t*)0x200007d0 = 0; *(uint8_t*)0x200007d1 = 0; *(uint8_t*)0x200007d2 = 0; *(uint8_t*)0x200007d3 = 0; *(uint8_t*)0x200007d4 = 0; *(uint8_t*)0x200007d5 = 0; *(uint8_t*)0x200007d6 = 0; *(uint8_t*)0x200007d7 = 0; *(uint8_t*)0x200007d8 = 0; *(uint8_t*)0x200007d9 = 0; *(uint8_t*)0x200007da = 0; *(uint8_t*)0x200007db = 0; *(uint8_t*)0x200007dc = 0; *(uint8_t*)0x200007dd = 0; *(uint8_t*)0x200007de = 0; *(uint8_t*)0x200007df = 0; *(uint8_t*)0x200007e0 = 0; *(uint8_t*)0x200007e1 = 0; *(uint8_t*)0x200007e2 = 0; *(uint8_t*)0x200007e3 = 0; *(uint8_t*)0x200007e4 = 0; *(uint8_t*)0x200007e5 = 0; *(uint8_t*)0x200007e6 = 0; *(uint8_t*)0x200007e7 = 0; *(uint8_t*)0x200007e8 = 0; *(uint8_t*)0x200007e9 = 0; *(uint8_t*)0x200007ea = 0; *(uint8_t*)0x200007eb = 0; *(uint8_t*)0x200007ec = 0; *(uint8_t*)0x200007ed = 0; *(uint8_t*)0x200007ee = 0; *(uint8_t*)0x200007ef = 0; *(uint8_t*)0x200007f0 = 0; *(uint8_t*)0x200007f1 = 0; *(uint8_t*)0x200007f2 = 0; *(uint8_t*)0x200007f3 = 0; *(uint8_t*)0x200007f4 = 0; *(uint8_t*)0x200007f5 = 0; *(uint8_t*)0x200007f6 = 0; *(uint8_t*)0x200007f7 = 0; *(uint8_t*)0x200007f8 = 0; *(uint8_t*)0x200007f9 = 0; *(uint8_t*)0x200007fa = 0; *(uint8_t*)0x200007fb = 0; *(uint8_t*)0x200007fc = 0; *(uint8_t*)0x200007fd = 0; *(uint8_t*)0x200007fe = 0; *(uint8_t*)0x200007ff = 0; *(uint8_t*)0x20000800 = 0; *(uint8_t*)0x20000801 = 0; *(uint8_t*)0x20000802 = 0; *(uint8_t*)0x20000803 = 0; *(uint8_t*)0x20000804 = 0; *(uint8_t*)0x20000805 = 0; *(uint8_t*)0x20000806 = 0; *(uint8_t*)0x20000807 = 0; *(uint8_t*)0x20000808 = 0; *(uint8_t*)0x20000809 = 0; *(uint8_t*)0x2000080a = 0; *(uint8_t*)0x2000080b = 0; *(uint8_t*)0x2000080c = 0; *(uint8_t*)0x2000080d = 0; *(uint8_t*)0x2000080e = 0; *(uint8_t*)0x2000080f = 0; *(uint8_t*)0x20000810 = 0; *(uint8_t*)0x20000811 = 0; *(uint8_t*)0x20000812 = 0; *(uint8_t*)0x20000813 = 0; *(uint32_t*)0x20000814 = 0; *(uint16_t*)0x20000818 = 0x70; *(uint16_t*)0x2000081a = 0x98; *(uint32_t*)0x2000081c = 0; *(uint64_t*)0x20000820 = 0; *(uint64_t*)0x20000828 = 0; *(uint16_t*)0x20000830 = 0x28; memcpy((void*)0x20000832, "\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000", 29); *(uint8_t*)0x2000084f = 4; *(uint32_t*)0x20000850 = 0xfffffffe; syscall(__NR_setsockopt, r[0], 0x4000000000000ul, 0x40ul, 0x20000540ul, 0x318ul); } int main(void) { syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }