// https://syzkaller.appspot.com/bug?id=d71f28b21dad3419f79cf010f30167620cb0cfff // 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 #ifndef __NR_bpf #define __NR_bpf 321 #endif 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); 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[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x20000080, "pim6reg1\000\000\000\000\000\000\000\000", 16); *(uint16_t*)0x20000090 = 0; syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x400454ca, /*arg=*/0x20000080ul); syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0ul, /*size=*/0ul); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0ul, /*flags=*/0x100002ul, /*mode=*/0ul); syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x40082404, /*period=*/0ul); syscall(__NR_perf_event_open, /*attr=*/0ul, /*pid=*/0, /*cpu=*/0ul, /*group=*/-1, /*flags=*/0ul); *(uint32_t*)0x20000080 = 0; *(uint32_t*)0x20000084 = 3; *(uint64_t*)0x20000088 = 0x20000440; memcpy( (void*)0x20000440, "\x85\x00\x00\x00\x2a\x00\x00\x00\x25\x00\x00\x00\x00\x00\x00\x00\x95\x00" "\x00\x00\x00\x00\x00\x00\xae\xcd\x48\xd6\x49\x4d\x61\x4d\xcc\x6f\xab\x53" "\x35\xec\x47\x0d\xb2\xc6\x16\x1d\xba\x39\x21\x76\xdd\x29\x63\x03\x8e\x1d" "\x69\xba\x7e\xa9\x4c\x50\x0d\xc4\xef\x2f\xad\x96\xed\x40\x6f\x21\xca\xf5" "\xad\xcf\x92\x05\x69\xc0\x0c\xc1\x19\x96\x84\xfa\x7c\x93\x83\x6d\x9e\xa2" "\xcf\xb0\xe6\x04\x36\xe0\x54\x25\xcc\x46\x86\xb0\x66\x70\x7d\xe9\x4a\x4f" "\x4d\x5f\xc7\x9c\x1f\xac\xa0\xf9\xd9\x92\x4b\xe4\x1a\x91\x69\xbd\xfa\xf1" "\x6d\xa9\x15\xb2\xe2\x49\xee\x1c\x6e\xee\x84\x30\x9e\x7a\x23\xc1\x9a\x39" "\x48\x48\x09\x53\x9f\xca\x4e\x0b\x6f\xab\x1a\xa7\xd5\x55\x45\xa3\x4e\xff" "\xa0\x77\xfa\xa5\x5c\x59\xe8\x82\x54\xf5\x40\x77\xf7\x99\xbf\x16\x83\x01" "\x00\x00\x00\xbf\x22\x55\xd6\xa0\x24\x4d\x35\xb2\x13\xbd\xa8\x4c\xc1\x72" "\xaf\xd8\xcc\x2e\x47\xa7\xd8\xb8\x5a\x5e\x3d\x77\xac\x46\x39\x20\xe2\x31" "\xb7\xae\x0d\xa8\x61\x6d\x2b\x79\xdb\x2e\x3d\x59\x86\xc8\x2b\x5a\xa9\x4e" "\x53\x9b\x20\x4d\x58\xf9\x1f\x5d\xa6\xc0\x25\xd0\x60\xab\x18\x6d\x94\xaf" "\x98\xaf\x1d\xa2\xb5\x95\x2e\xb1\x58\x55\x93\x3a\x21\x23\x04\xe0\x35\xf7" "\xa3\x5d\xfc\x72\xc8\x12\x56\xa5\x5a\x25\xf8\xfe\x3b\x28\xd7\xe5\x3c\x78" "\xfb\xfe\x5a\xb0\x25\x5f\x34\x71\x60\xec\x83\x07\x00\x00\x02\x00\x00\x00" "\x40\x15\xcf\x10\x45\x3f\x6c\x0b\x97\x3b\x81\xa4\x84\xeb\xad\x04\x85\x9d" "\x92\x83\x65\xa7\xea\x3f\xab\x8b\x4b\x38\x0a\x00\xd7\x2b\x00\x00\x00\x00" "\x00\x00\x1c\xf5\x55\xc1\x4d\x56\xb5\x1c\x22\x98\x23\x7b\xeb\xfc\x08\xe0" "\xd5\x97\x6a\x94\x2b\x84\x69\x70\xcf\xd9\x8b\x9d\x41\x39\xf1\x11\x1f\x2c" "\xc5\xe4\x6a\xc1\xc6\x0a\x9b\x03\x00\x74\xbf\xbc\xd4\xb0\x90\x12\x17\x54" "\x84\x13\x5f\x0e\x51\x9f\x0b\x1e\x4a\xaa\x02\x6d\x57\x0e\xcb\x5e\x8c\xdd" "\xbe\xd6\x5f\xf7\x02\x00\x00\x00\xa3\xff\x4f\x8a\x4c\xf7\x96\xb0\x7a\x6f" "\xf6\x1c\x55\x52\x41\x7f\xd7\x03\xf7\xf1\x4d\x8b\x78\xac\x02\xca\x3c\xdf" "\x6a\x66\x2d\xb1\xc9\xc8\x9c\x91\x20\x07\x2a\x5d\x00\xdc\xdd\x85\x95\x35" "\x6c\x9b\x24\x92\xaa\xf1\x26\x4d\x4e\xf4\xa4\x10\xc8\x82\x83\x48\x67\xbc" "\xd2\xb6\xe5\x59\xd1\x78\x79\x57\x0c\x8a\xd9\x43\xe3\x92\x95\x5f\x4f\x97" "\x9e\xa1\x32\x01\xba\xfe\xdc\xd2\x06\x3d\x11\xdd\x66\x56\x47\x22\x3c\x78" "\xa9\x96\x81\x00\x00\x00\x05\x71\xcb\xb1\x7d\x9f\x37\x28\x24\x62\xf0\xe9" "\xc1\x47\xc0\xd4\x97\xc6\x14\x33\xc6\xcc\xc3\x56\x01\xee\xf9\x7e\xe6\x11" "\xbe\x8c\x97\xf4\x15\x1f\xfd\xf6\xf7\x82\x05\x49\xcd\xa6\xcb\x79\x9c\x6e" "\x92\x49\x66\xa7\xf9\x0b\xf8\xfd\x1e\x75\xee\x76\xbd\x89\x34\x6c\xfb\xb5" "\x56\x7e\x54\xd3\x50\x47\x23\x17\x7d\x35\x6c\x46\x04\xb7\xa4\x92\xec\xec" "\x37\xe8\x3e\xfc\xee\xfd\x7c\xa2\x53\x36\x59\xed\xc8\xbe\x05\xcc\x85\x45" "\x1c\x6a\x14\x50\x74\x34\xeb\x54\xb6\xf4\x3c\xae\xa5\xc4\xbf\x69\x04\x41" "\x97\x4b\x15\x5f\x5a\xdc\x68\x1a\x03\xc0\xbb\xb8\x35\x88\x56\x17\x5e\x2c" "\xe8\xb0\xcb\xbb\xe3\xc0\x33\xe5\x4f\xfc\xa9\xec\x9a\x7a\x37\x55\xe0\xf2" "\x09\x15\x0a\x07\x68\x2c\x4e\x14\xe3\xa8\x35\x58\xdf\x6f\x3f\xc9\x7f\x17" "\x30\xa1\x36\xbd\xee\x07\xe9\x8c\xb9\x84\xb2\xe2\x30\x4a\x1b\x63\xaf\xef" "\xdb\x63\x6e\x56\xbb\xaa\xe4\xe6\x21\x36\x57\x4b\xc6\x37\x1a\x0b\xb2\xbe" "\x1a\x96\x2a\xae\x9c\x12\x58\xda\x6e\xf5\x90\xe1\xd8\x5e\xa9\xe1\x2b\x30" "\x25\xf4\x3e\x7e\x08\xcc\xff\xc5\x06\x4d\xea\x4c\x39\xcf\x4b\x98\xe1\xfc" "\x6e\xfb\x59\x78\xf5\x1e\x16\xb6\x78\xec\xa0\xb6\x58\xa5\x60\x08\x94\x8e" "\x56\x1a\x98\x45\xe4\xff\x29\xe2\xbd\xb1\xd0\xb9\x23\xb2\x72\x34\x1c\x5e" "\x09\x3f\xd6\x6a\x29\x43\x51\xc5\x35\x6c\x1d\x06\xc9\x2c\xf8\xce\x3c\x7c" "\x56\xcd\x31\x12\x16\x24\xd7\x45\x17\xfd\x36\x66\x27\x7f\x67\x0e\x81\x2b" "\x28\xe2\xf3\x0d\x03\x5c\xee\x5d\x0e\x77\xa3\xc7\x22\x00\x00\x00\x00\x00" "\x00\x00\x05\xa4\x74\x81\x6b\xc5\x9d\x2e\x2a\x00\x09\x24\x19\x30\x4b\x33" "\x8a\x98\x7e\x9d\x30\x44\xd8\x56\xce\x24\xf3\x70\x03\x0b\xe3\xb5\xf7\x9f" "\x03\x4b\x8d\x3e\xbc\xe6\x86\x63\xef\x5a\xf4\x69\xab\xe7\x5b\x31\x4f\xae" "\x31\xa0\x44\x58\x59\xa5\xec\xe8\xfb\x11\xa4\xee\x8e\x46\x35\x4c\x9c\x3a" "\x04\x1e\x12\x28\x2c\xe2\x44\x63\xaa\xf2\x83\x45\xbd\x16\x8b\x41\x77\xce" "\x37\xed\x85\x46\x4c\x31\x67\x90\x53\xe7\xf9\xd0\x4b\xb5\xcb\x51\xda\x0b" "\x79\x58\x98\x9f\xd7\x0f\x09\x00\x00\x00\x00\x00\x00\x00\x4f\xc4\xbd\xa3" "\x45\x36\x02\x00\x45\x35\xa9\x76\xea\xcd\x3a\xda\xa4\xd2\xee\x6f\xe0\xd0" "\x72\xcc\xd4\x43\x41\xf7\xfd\x53\xdf\x58\xae\x79\x1e\xe8\xb4\x89\xa7\xc9" "\xef\xe3\x62\x5a\x9d\x97\x1b\x59\x97\x48\x5d\x6a\x06\x3d\xc6\xf7\x35\x9e" "\x2e\xcc\xc2\xfb\x39\xd4\x01\xad\xf5\x9d\x44\xe5\x8e\xb1\xc6\x0b\x34\x75" "\xbe\x31\xa9\xb7\xcf\x42\xb6\x40\x23\x12\xd2\x72\x5b\x8d\x9f\xa7\x00\xa8" "\x64\x07\xe7\x9a\xe2\x9d\x2c\x11\x7c\xa6\x5f\xc8\x6c\x2d\xce\x97\xaa\x03" "\x27\x9a\x66\xec\x87\x12\x22\x19\xb0\xf7\x96\xab\x92\xb1\xad\xec\xae\x50" "\xfd\xb4\x0f\x7f\x02\xf7\x50\xd6\xc9\x77\xa1\x91\x85\x2c\x9a\xe0\x31\xdb" "\x04\x4b\x23\x53\x19\x95\x46\x60\x9f\x9f\x69\xa6\xcf\xef\xdf\x87\x9d\x44" "\x7d\xf5\x3f\x3b\x9b\x70\xd1\x03\x55\xb0\x03\x00\x00\x00\x00\x00\x00\x00" "\x55\x3d\x18\xa6\xcc\x50\xfe\xeb\x7b\xfa\xd9\xb7\xbe\x32\x83\xb6\x45\x0d" "\x26\x4e\x77\x12\xd2\xf1\xd7\x00\x45\x48\xb1\x91\x62\xce\xf0\x4d\x18\xd4" "\xf5\x98\x7b\xaa\xb9\x7a\x9b\xfb\xd8\xf1\x85\xb5\x63\x18\x20\x42\x0b\xf5" "\xb6\x52\x2c\x0e\x21\xc8\x82\xc6\x6f\x4f\x25\xff\xb6\xd9\x5e\x07\xde\x02" "\x20\x5f\xca\x4f\x18\xa2\xeb\x5b\x63\xe4\x5d\x5d\x80\xfe\x52\x73\x40\x93" "\x5a\xa3\xc0\xb4\xf3\xf4\x5b\xff\xf2\x41\x8a\x18\x21\x77\x47\xae\x44\x2e" "\x31\x56\x0e\x5b\x74\x14\x45\xea\x2a\x1a\xce\xe2\xa8\x14\x25\xff\x00\x00" "\x00\xd2\xa0\xa7\x65\xd2\x0b\x30\xf8\x7a\xf9\x76\xa4\x6f\x9a\x9a\x1a\xc7" "\xde\xa1\xea\x68\x45\xf9\xaa\x66\x23\x92\x0d\xac\xc1\x07\xf5\x32\x34\x8c" "\xc2\x11\x64\xef\xe7\x94\x87\x4e\xac\x73\x38\x1e\x96\x1f\x3d\x9c\x8c\x21" "\x57\x8f\xe3\x24\x50\x97\xc2\x80\xab\xe5\x14\x27\xb9\xf6\xcd\x72\xb5\xda" "\x6d\x02\x52\x80\x3c\x66\x73\x0c\xd5\xea\xc9\x07\xf0\x9b\x96\x95\x90\x63" "\x13\xf8\x87\x35\xfc\xe5\x11\x5d\xc8\x3e\xd7\x3d\x8e\xe4\xa9\x13\x22\x60" "\x8c\x6f\xc0\x1e\x1b\x9e\x16\x58\x7b\xb5\xf7\x21\x30\x3e\x6b\x89\xe5\xc5" "\x4d\x68\x0a\xc6\x6d\x09\xaf\x90\xdb\xf5\x00\x00\x00\x00\x00\x00\xfa\x08" "\xad\x07\x31\xc4\xb8\x39\x68\x8b\x22\xc4\xda\x2a\x6b\xc4\xcf\x45\x85\x4d" "\x22\x1a\x2d\x5f\x96\xbc\x64\x64\x7f\x15\xda\xa2\xba\x79\xcd\x0f\x42\x54" "\xed\x55\x21\x79\x12\xef\x84\xbd\x29\x27\xdf\x82\xfc\x06\x1a\xef\x29\x20" "\xc4\x9b\x2a\x90\x88\x6d\xa7\x55\x61\x17\x3f\xa1\x86\xcb\x7e\xe8\x6d\xd4" "\x28\x5c\x47\x21\xeb\x42\x8c\x95\x32\x96\xbb\x2f\x5d\x82\x5d\xa5\x4d\xbe" "\xf0\x7c\x1b\x34\x9b\x49\x01\xe0\x93\xd1\x3e\x6b\x9a\x00\x00\x00\x9b\x5b" "\x22\xe8\x87\xbc\x06\x1d\x40\xbc\xaf\x0a\xa1\x86\x23\xfd\x9b\x71\x79\xcc" "\xc6\x92\xba\x74\xb5\x31\xb6\x5c\x4d\xec\xf9\xd0\x80\xa8\xac\x7e\x82\xd4" "\xcd\xe1\x26\x7a\xa6\x4b\x2a\x94\xfd\x87\xa0\x09\xe6\x74\x2c\x2d\xdc\x3a" "\x9d\x7e\xcc\xbb\x18\x31\xb1\xfa\x21\x82\x77\xc2\x81\x4a\x91\xca\xb7\xcb" "\x59\xc6\x97\x16\x6d\x6f\x1b\xb1\xa3\x60\x47\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\xf9\xf9\xb4\xce\x7e\x87\x1f\x50\x70\x84\xc8\xc8\x8e\x06\x52\xde\xcb" "\xe5\x79\xb0\x3e\xd8\x4e\xa9\x45\x97\xdd\x10\x59\x62\x0a\x05\x0f\x69\xea" "\x03\xb9\x9b\x4e\x19\xd3\x5f\x4a\x3b\x54\xe9\x6a\xe2\x17\x2e\xff\xec\xec" "\x80\xf6\xba\xa4\xbf\x69\xa6\xeb\xf5\x39\x28\x82\xdf\x78\xb0\x98\x3e\x66" "\x2d\xc0\xcb\x64\xb7\x7f\x3f\x00\x6b\x6b\x25\x44\x31\x97\xae\x93\xf0\xbe" "\x6d\xe5\xa7\x03\xd0\x03\xf0\x07\x20\x94\x3c\x0e\x4b\x33\xaf\x00\x00\x00" "\x00\x00\x00\x00\x00\x00", 1770); *(uint64_t*)0x20000090 = 0x20000000; memcpy((void*)0x20000000, "GPL\000", 4); *(uint32_t*)0x20000098 = 0; *(uint32_t*)0x2000009c = 0; *(uint64_t*)0x200000a0 = 0; *(uint32_t*)0x200000a8 = 0; *(uint32_t*)0x200000ac = 0; memset((void*)0x200000b0, 0, 16); *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = 0; *(uint32_t*)0x200000c8 = -1; *(uint32_t*)0x200000cc = 8; *(uint64_t*)0x200000d0 = 0; *(uint32_t*)0x200000d8 = 0; *(uint32_t*)0x200000dc = 0x10; *(uint64_t*)0x200000e0 = 0; *(uint32_t*)0x200000e8 = 0; *(uint32_t*)0x200000ec = 0; *(uint32_t*)0x200000f0 = -1; *(uint32_t*)0x200000f4 = 0; *(uint64_t*)0x200000f8 = 0; *(uint64_t*)0x20000100 = 0; *(uint32_t*)0x20000108 = 0x10; *(uint32_t*)0x2000010c = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000080ul, /*size=*/0x90ul); *(uint32_t*)0x20000000 = 0; syscall(__NR_bpf, /*cmd=*/0x17ul, /*arg=*/0x20000000ul, /*size=*/8ul); syscall(__NR_bpf, /*cmd=*/0xful, /*arg=*/0ul, /*size=*/0ul); *(uint32_t*)0x200007c0 = -1; *(uint32_t*)0x200007c4 = 0; *(uint64_t*)0x200007c8 = 0; syscall(__NR_bpf, /*cmd=*/0xful, /*arg=*/0x200007c0ul, /*size=*/0x10ul); *(uint32_t*)0x200004c0 = 2; *(uint32_t*)0x200004c4 = 4; *(uint32_t*)0x200004c8 = 4; *(uint32_t*)0x200004cc = 8; *(uint32_t*)0x200004d0 = 0; *(uint32_t*)0x200004d4 = -1; *(uint32_t*)0x200004d8 = 0; memset((void*)0x200004dc, 0, 16); *(uint32_t*)0x200004ec = 0; *(uint32_t*)0x200004f0 = -1; *(uint32_t*)0x200004f4 = 0; *(uint32_t*)0x200004f8 = 0; *(uint32_t*)0x200004fc = 0; *(uint64_t*)0x20000500 = 0; res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x200004c0ul, /*size=*/0x48ul); if (res != -1) r[0] = res; *(uint32_t*)0x20000040 = 0; *(uint32_t*)0x20000044 = 0; *(uint32_t*)0x20000048 = 0; *(uint32_t*)0x2000004c = 0; *(uint32_t*)0x20000050 = 0x1141; *(uint32_t*)0x20000054 = r[0]; *(uint32_t*)0x20000058 = 0; memset((void*)0x2000005c, 0, 16); *(uint32_t*)0x2000006c = 0; *(uint32_t*)0x20000070 = -1; *(uint32_t*)0x20000074 = 0; *(uint32_t*)0x20000078 = 0; *(uint32_t*)0x2000007c = 0x10000; *(uint64_t*)0x20000080 = 0; syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x20000040ul, /*size=*/0x48ul); memcpy((void*)0x20000180, "memory.events\000", 14); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000180ul, /*flags=*/0x26e1ul, /*mode=*/0ul); if (res != -1) r[1] = res; *(uint64_t*)0x20000040 = 0; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x4030582a, /*period=*/0x20000040ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }