// https://syzkaller.appspot.com/bug?id=4b0e06a6714d9421fac0f2e13ca91140b579fb52 // 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 #include 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 long syz_open_dev(volatile long a0, volatile long a1, volatile long a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { unsigned long nb = a1; char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(nb % 10); nb /= 10; } return open(buf, a2 & ~O_CREAT, 0); } } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int 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 = 0; for (;; 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 (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // prlimit64 arguments: [ // pid: pid (resource) // res: rlimit_type = 0xe (8 bytes) // new: ptr[in, rlimit] { // rlimit { // soft: intptr = 0x8 (8 bytes) // hard: intptr = 0x8b (8 bytes) // } // } // old: nil // ] *(uint64_t*)0x200000000140 = 8; *(uint64_t*)0x200000000148 = 0x8b; syscall(__NR_prlimit64, /*pid=*/0, /*res=RLIMIT_RTPRIO*/ 0xeul, /*new=*/0x200000000140ul, /*old=*/0ul); // sched_setscheduler arguments: [ // pid: pid (resource) // policy: sched_policy = 0x2 (8 bytes) // prio: ptr[in, int32] { // int32 = 0x6 (4 bytes) // } // ] *(uint32_t*)0x200000000200 = 6; syscall(__NR_sched_setscheduler, /*pid=*/0, /*policy=SCHED_RR*/ 2ul, /*prio=*/0x200000000200ul); // mmap arguments: [ // addr: VMA[0xb36000] // len: len = 0xb36000 (8 bytes) // prot: mmap_prot = 0xb635773f06ebbeef (8 bytes) // flags: mmap_flags = 0x8031 (8 bytes) // fd: fd (resource) // offset: intptr = 0x0 (8 bytes) // ] syscall( __NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0xb36000ul, /*prot=PROT_GROWSUP|PROT_SEM|PROT_WRITE|PROT_READ|PROT_EXEC|0xb635773f04ebbee0*/ 0xb635773f06ebbeeful, /*flags=MAP_POPULATE|MAP_FIXED|MAP_ANONYMOUS|MAP_SHARED*/ 0x8031ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); // socketpair$unix arguments: [ // domain: const = 0x1 (8 bytes) // type: unix_socket_type = 0x2 (8 bytes) // proto: const = 0x0 (4 bytes) // fds: ptr[out, unix_pair] { // unix_pair { // fd0: sock_unix (resource) // fd1: sock_unix (resource) // } // } // ] res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=SOCK_DGRAM*/ 2ul, /*proto=*/0, /*fds=*/0x200000000200ul); if (res != -1) { r[0] = *(uint32_t*)0x200000000200; r[1] = *(uint32_t*)0x200000000204; } // connect$unix arguments: [ // fd: sock_unix (resource) // addr: nil // addrlen: len = 0x0 (8 bytes) // ] syscall(__NR_connect, /*fd=*/r[0], /*addr=*/0ul, /*addrlen=*/0ul); // sendmmsg$unix arguments: [ // fd: sock_unix (resource) // mmsg: ptr[in, array[send_mmsghdr_un]] { // array[send_mmsghdr_un] { // } // } // vlen: len = 0x400000000000041 (8 bytes) // f: send_flags = 0x0 (8 bytes) // ] syscall(__NR_sendmmsg, /*fd=*/r[1], /*mmsg=*/0x200000000000ul, /*vlen=*/0x400000000000041ul, /*f=*/0ul); // recvmmsg arguments: [ // fd: sock (resource) // mmsg: ptr[in, array[recv_mmsghdr]] { // array[recv_mmsghdr] { // } // } // vlen: len = 0x80002c1 (8 bytes) // f: recv_flags = 0x2 (8 bytes) // timeout: nil // ] syscall(__NR_recvmmsg, /*fd=*/r[0], /*mmsg=*/0x200000000040ul, /*vlen=*/0x80002c1ul, /*f=MSG_PEEK*/ 2ul, /*timeout=*/0ul); // syz_open_dev$tty1 arguments: [ // dev: const = 0xc (8 bytes) // major: const = 0x4 (8 bytes) // minor: intptr = 0x1 (8 bytes) // ] // returns fd_tty res = -1; res = syz_open_dev(/*dev=*/0xc, /*major=*/4, /*minor=*/1); if (res != -1) r[2] = res; // ioctl$KDFONTOP_SET arguments: [ // fd: fd_tty (resource) // cmd: const = 0x4b72 (4 bytes) // arg: ptr[in, console_font_op[KD_FONT_OP_SET, in]] { // console_font_op[KD_FONT_OP_SET, in] { // op: const = 0x0 (4 bytes) // flags: int32 = 0x5 (4 bytes) // width: int32 = 0x18 (4 bytes) // height: int32 = 0x6 (4 bytes) // charcount: int32 = 0x200 (4 bytes) // pad = 0x0 (4 bytes) // data: ptr[in, buffer] { // buffer: {1a e1 93 37 aa 15 1f 36 ae 49 bb 3f 8c b9 5c 5b f8 40 d4 // f1 e5 5e fa af 09 8d 47 a7 0e b3 6a 73 09 00 25 00 00 00 00 00 0f // 47 43 f4 90 c5 85 10 8c 13 31 c7 74 92 99 a2 5a 70 5f 50 96 cb 26 // 8c bc 60 ef d6 80 e1 be 25 07 00 00 00 00 00 00 00 47 24 71 ff 55 // 0c 00 10 00 00 07 f3 c7 b6 1a be 41 62 25 60 04 ea 8c a5 12 b5 f3 // 79 c6 eb 32 57 ed a0 8f 7e 69 59 09 00 00 00 4d 13 18 4d 38 27 47 // e0 35 b4 72 25 25 e0 0a de 86 b4 c6 d1 e1 57 c7 5d 15 c1 f9 61 eb // c0 a6 4d 7f 2a 73 f8 97 9f ce ca ca a6 4f 9b 90 69 eb cc 1d 5b 47 // 1e db c4 f6 c7 f1 b9 8a e7 4e 90 9a a6 f2 5b 7f a7 7b f9 cd 4e d3 // 6d 5c 53 dc 51 9d 11 c3 cc 1c 22 a3 b8 6c f3 c6 45 41 3f ce a0 ce // 9d ed 70 36 99 d2 bb 6a 4a 66 3b 99 b6 06 9d a5 aa f6 47 85 a5 88 // 7c 31 26 1d 4b 9e 57 ee 07 00 00 00 de f6 f2 55 ca 26 10 8f 11 f0 // 20 47 d4 7f 2d 0f ec 30 f7 e9 24 82 f7 14 96 e1 84 21 4a 4e 0c 5f // dc 48 b0 af 0c 04 78 94 00 16 d8 f0 99 0a 0e 10 90 fd 51 53 80 aa // e8 3c 5e ae ed 33 87 01 57 4b 64 20 0a 16 ef 28 11 fa dc f1 e0 f4 // 9a 51 4d f5 29 06 1e 09 ce 45 e3 f3 03 a0 3f e9 b4 a6 bc fa 7d 04 // 59 4e 4f 6d 07 14 a2 e1 4e a1 27 ab 37 d6 4a 5e 0d b6 30 cd 4f 4a // 2e 6c 98 5a 54 2f f2 0a 9b 21 93 f2 65 f9 3a 25 8a 88 dd 6c 9d 6a // 92 6d d2 3d 32 42 58 49 c5 d9 21 00 07 66 0a 61 7f 22 13 3b 6c b5 // 08 7f 4c 60 57 94 2a a1 81 93 17 2b d9 95 fa 70 a1 f9 49 b1 96 f2 // e2 a3 c1 75 85 85 75 71 3b e5 ee 3f 7f 4d ce cc 98 12 3f 9d ed 3a // fd eb e1 3d 79 a7 f7 fc b2 46 9a e0 ac 50 31 11 40 16 12 df 7e e9 // 95 f7 4f b9 7a 63 bf 62 d6 1f 78 c0 62 f9 59 11 9a b5 0c 1f 70 6a // 93 01 21 eb cd 53 cc b9 3d 15 81 86 ed 36 07 50 ca 8e 72 81 50 d9 // 88 84 4b 9a 3c ff 46 59 1c ca ff 30 75 b8 6e a6 17 1b 04 6b 85 61 // 68 f4 03 b5 25 3a 5c c3 93 43 0a 09 a4 48 9a 08 95 57 1e 59 7a c8 // 84 6f 94 5f fb 37 2a 88 d3 a2 b4 63 dc 96 14 16 c8 0c 55 77 3f 91 // 70 20 75 1e d5 1c fd 73 c1 e0 6f ba dd 15 6d 56 be dc 11 7a f9 5d // 24 2d 6d 07 00 2c e3 4d cc d6 00 5e 94 4a fa 92 b2 2e c9 a6 98 46 // 9c 6e dc 06 ca a2 cf cd 61 91 26 07 d4 59 b4 c2 8e be a9 74 5b cd // 46 97 d7 5c 96 01 fd 33 3d 3c d7 97 96 3a 3c 71 b7 cc 5f dc 75 6d // a8 d9 72 07 93 6e 5f 53 b5 3b 73 25 33 c2 72 2e 03 00 22 93 e3 79 // 66 61 16 02 f2 97 de 6f f5 40 87 77 d7 a9 3c 45 ce e3 ee 5c 56 01 // a4 e9 42 66 b2 95 ea 7a 86 81 2a 7a b8 89 6e c5 ea 1b 12 64 3e 18 // 44 b1 85 73 45 28 39 9e 62 bc eb 87 00 cc 6c d4 91 e4 a4 43 0d 0a // 3b a3 29 a5 a2 fa 17 0f d0 b1 cc 4b a8 29 4d e9 88 cd 35 df 2c d7 // 34 4a a8 a9 f3 43 2b 96 fb 88 9c 02 f4 84 f6 35 20 cc 34 66 a3 c2 // 73 3d 45 f1 76 93 1b 2d b1 8d ba 54 99 1a 95 53 ce db 7f 58 57 86 // 38 8d 40 42 db ae 1c 95 b7 69 e3 d4 e0 36 e8 af ea 0a 04 c0 4f 54 // 2b 15 2c a1 fd 1f 8e fe e6 04 25 c5 a1 22 fd 1b 90 e9 86 35 28 4a // bd 9f 21 7d 9e 19 cb 2a 64 b3 54 c9 09 cc 47 d7 30 51 14 99 01 48 // a7 29 1c b0 fe 2d 1c 77 3a 66 64 b6 6a e0 4a a6 2c 53 4d 07 2a e5 // 4c 2c a0 d5 96 2c c5 89 45 d8 92 4a bf c4 d5 af 92 24 62 50 74 30 // d8 f2 c1 74 79 a6 67 8b 0b 37 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 f8 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x400) // } // } // } // ] *(uint32_t*)0x200000000180 = 0; *(uint32_t*)0x200000000184 = 5; *(uint32_t*)0x200000000188 = 0x18; *(uint32_t*)0x20000000018c = 6; *(uint32_t*)0x200000000190 = 0x200; *(uint64_t*)0x200000000198 = 0x200000000880; memcpy( (void*)0x200000000880, "\x1a\xe1\x93\x37\xaa\x15\x1f\x36\xae\x49\xbb\x3f\x8c\xb9\x5c\x5b\xf8\x40" "\xd4\xf1\xe5\x5e\xfa\xaf\x09\x8d\x47\xa7\x0e\xb3\x6a\x73\x09\x00\x25\x00" "\x00\x00\x00\x00\x0f\x47\x43\xf4\x90\xc5\x85\x10\x8c\x13\x31\xc7\x74\x92" "\x99\xa2\x5a\x70\x5f\x50\x96\xcb\x26\x8c\xbc\x60\xef\xd6\x80\xe1\xbe\x25" "\x07\x00\x00\x00\x00\x00\x00\x00\x47\x24\x71\xff\x55\x0c\x00\x10\x00\x00" "\x07\xf3\xc7\xb6\x1a\xbe\x41\x62\x25\x60\x04\xea\x8c\xa5\x12\xb5\xf3\x79" "\xc6\xeb\x32\x57\xed\xa0\x8f\x7e\x69\x59\x09\x00\x00\x00\x4d\x13\x18\x4d" "\x38\x27\x47\xe0\x35\xb4\x72\x25\x25\xe0\x0a\xde\x86\xb4\xc6\xd1\xe1\x57" "\xc7\x5d\x15\xc1\xf9\x61\xeb\xc0\xa6\x4d\x7f\x2a\x73\xf8\x97\x9f\xce\xca" "\xca\xa6\x4f\x9b\x90\x69\xeb\xcc\x1d\x5b\x47\x1e\xdb\xc4\xf6\xc7\xf1\xb9" "\x8a\xe7\x4e\x90\x9a\xa6\xf2\x5b\x7f\xa7\x7b\xf9\xcd\x4e\xd3\x6d\x5c\x53" "\xdc\x51\x9d\x11\xc3\xcc\x1c\x22\xa3\xb8\x6c\xf3\xc6\x45\x41\x3f\xce\xa0" "\xce\x9d\xed\x70\x36\x99\xd2\xbb\x6a\x4a\x66\x3b\x99\xb6\x06\x9d\xa5\xaa" "\xf6\x47\x85\xa5\x88\x7c\x31\x26\x1d\x4b\x9e\x57\xee\x07\x00\x00\x00\xde" "\xf6\xf2\x55\xca\x26\x10\x8f\x11\xf0\x20\x47\xd4\x7f\x2d\x0f\xec\x30\xf7" "\xe9\x24\x82\xf7\x14\x96\xe1\x84\x21\x4a\x4e\x0c\x5f\xdc\x48\xb0\xaf\x0c" "\x04\x78\x94\x00\x16\xd8\xf0\x99\x0a\x0e\x10\x90\xfd\x51\x53\x80\xaa\xe8" "\x3c\x5e\xae\xed\x33\x87\x01\x57\x4b\x64\x20\x0a\x16\xef\x28\x11\xfa\xdc" "\xf1\xe0\xf4\x9a\x51\x4d\xf5\x29\x06\x1e\x09\xce\x45\xe3\xf3\x03\xa0\x3f" "\xe9\xb4\xa6\xbc\xfa\x7d\x04\x59\x4e\x4f\x6d\x07\x14\xa2\xe1\x4e\xa1\x27" "\xab\x37\xd6\x4a\x5e\x0d\xb6\x30\xcd\x4f\x4a\x2e\x6c\x98\x5a\x54\x2f\xf2" "\x0a\x9b\x21\x93\xf2\x65\xf9\x3a\x25\x8a\x88\xdd\x6c\x9d\x6a\x92\x6d\xd2" "\x3d\x32\x42\x58\x49\xc5\xd9\x21\x00\x07\x66\x0a\x61\x7f\x22\x13\x3b\x6c" "\xb5\x08\x7f\x4c\x60\x57\x94\x2a\xa1\x81\x93\x17\x2b\xd9\x95\xfa\x70\xa1" "\xf9\x49\xb1\x96\xf2\xe2\xa3\xc1\x75\x85\x85\x75\x71\x3b\xe5\xee\x3f\x7f" "\x4d\xce\xcc\x98\x12\x3f\x9d\xed\x3a\xfd\xeb\xe1\x3d\x79\xa7\xf7\xfc\xb2" "\x46\x9a\xe0\xac\x50\x31\x11\x40\x16\x12\xdf\x7e\xe9\x95\xf7\x4f\xb9\x7a" "\x63\xbf\x62\xd6\x1f\x78\xc0\x62\xf9\x59\x11\x9a\xb5\x0c\x1f\x70\x6a\x93" "\x01\x21\xeb\xcd\x53\xcc\xb9\x3d\x15\x81\x86\xed\x36\x07\x50\xca\x8e\x72" "\x81\x50\xd9\x88\x84\x4b\x9a\x3c\xff\x46\x59\x1c\xca\xff\x30\x75\xb8\x6e" "\xa6\x17\x1b\x04\x6b\x85\x61\x68\xf4\x03\xb5\x25\x3a\x5c\xc3\x93\x43\x0a" "\x09\xa4\x48\x9a\x08\x95\x57\x1e\x59\x7a\xc8\x84\x6f\x94\x5f\xfb\x37\x2a" "\x88\xd3\xa2\xb4\x63\xdc\x96\x14\x16\xc8\x0c\x55\x77\x3f\x91\x70\x20\x75" "\x1e\xd5\x1c\xfd\x73\xc1\xe0\x6f\xba\xdd\x15\x6d\x56\xbe\xdc\x11\x7a\xf9" "\x5d\x24\x2d\x6d\x07\x00\x2c\xe3\x4d\xcc\xd6\x00\x5e\x94\x4a\xfa\x92\xb2" "\x2e\xc9\xa6\x98\x46\x9c\x6e\xdc\x06\xca\xa2\xcf\xcd\x61\x91\x26\x07\xd4" "\x59\xb4\xc2\x8e\xbe\xa9\x74\x5b\xcd\x46\x97\xd7\x5c\x96\x01\xfd\x33\x3d" "\x3c\xd7\x97\x96\x3a\x3c\x71\xb7\xcc\x5f\xdc\x75\x6d\xa8\xd9\x72\x07\x93" "\x6e\x5f\x53\xb5\x3b\x73\x25\x33\xc2\x72\x2e\x03\x00\x22\x93\xe3\x79\x66" "\x61\x16\x02\xf2\x97\xde\x6f\xf5\x40\x87\x77\xd7\xa9\x3c\x45\xce\xe3\xee" "\x5c\x56\x01\xa4\xe9\x42\x66\xb2\x95\xea\x7a\x86\x81\x2a\x7a\xb8\x89\x6e" "\xc5\xea\x1b\x12\x64\x3e\x18\x44\xb1\x85\x73\x45\x28\x39\x9e\x62\xbc\xeb" "\x87\x00\xcc\x6c\xd4\x91\xe4\xa4\x43\x0d\x0a\x3b\xa3\x29\xa5\xa2\xfa\x17" "\x0f\xd0\xb1\xcc\x4b\xa8\x29\x4d\xe9\x88\xcd\x35\xdf\x2c\xd7\x34\x4a\xa8" "\xa9\xf3\x43\x2b\x96\xfb\x88\x9c\x02\xf4\x84\xf6\x35\x20\xcc\x34\x66\xa3" "\xc2\x73\x3d\x45\xf1\x76\x93\x1b\x2d\xb1\x8d\xba\x54\x99\x1a\x95\x53\xce" "\xdb\x7f\x58\x57\x86\x38\x8d\x40\x42\xdb\xae\x1c\x95\xb7\x69\xe3\xd4\xe0" "\x36\xe8\xaf\xea\x0a\x04\xc0\x4f\x54\x2b\x15\x2c\xa1\xfd\x1f\x8e\xfe\xe6" "\x04\x25\xc5\xa1\x22\xfd\x1b\x90\xe9\x86\x35\x28\x4a\xbd\x9f\x21\x7d\x9e" "\x19\xcb\x2a\x64\xb3\x54\xc9\x09\xcc\x47\xd7\x30\x51\x14\x99\x01\x48\xa7" "\x29\x1c\xb0\xfe\x2d\x1c\x77\x3a\x66\x64\xb6\x6a\xe0\x4a\xa6\x2c\x53\x4d" "\x07\x2a\xe5\x4c\x2c\xa0\xd5\x96\x2c\xc5\x89\x45\xd8\x92\x4a\xbf\xc4\xd5" "\xaf\x92\x24\x62\x50\x74\x30\xd8\xf2\xc1\x74\x79\xa6\x67\x8b\x0b\x37\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 1024); syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x4b72, /*arg=*/0x200000000180ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }