// https://syzkaller.appspot.com/bug?id=28bc35dd6f026b2878e30804670f6f0c39932f16 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t 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 { char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf)); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void loop() { long res = 0; memcpy((void*)0x20ca9ff5, "/dev/loop#", 11); res = syz_open_dev(0x20ca9ff5, 0, 0x82); if (res != -1) r[0] = res; memcpy((void*)0x200000c0, "\x74\x08\x6e\x75\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c\x00", 15); res = syscall(__NR_memfd_create, 0x200000c0, 2); if (res != -1) r[1] = res; *(uint64_t*)0x20f50f90 = 0x20000040; memcpy((void*)0x20000040, "\xaa", 1); *(uint64_t*)0x20f50f98 = 1; syscall(__NR_pwritev, r[1], 0x20f50f90, 1, 0x81006); syscall(__NR_ioctl, r[0], 0x4c00, r[1]); *(uint64_t*)0x20000080 = 0; syscall(__NR_sendfile, r[0], r[0], 0x20000080, 0x102000004); *(uint64_t*)0x20000200 = 0; *(uint64_t*)0x20000208 = 0; *(uint64_t*)0x20000210 = 0; *(uint64_t*)0x20000218 = 0xf81; *(uint64_t*)0x20000220 = 0x4e; *(uint32_t*)0x20000228 = 0; *(uint32_t*)0x2000022c = 6; *(uint32_t*)0x20000230 = 0xc; *(uint32_t*)0x20000234 = 1; memcpy((void*)0x20000238, "\x70\x55\x20\x89\x24\x59\xe4\x96\x77\xc8\xd6\x49\xba\x01\x0d\xd0\xe4" "\xab\x45\xf7\x33\xaf\x92\x14\x3b\x0c\x6a\x93\x7e\xd2\x03\x9a\x52\xa8" "\x2e\x8b\xc5\xea\x3a\xab\x27\x43\xfa\x29\xdf\xde\xb3\xcb\xab\xbc\xb8" "\x75\xbc\xc9\x36\x1b\xa6\x0b\x99\x1a\x31\x7e\x65\xac", 64); memcpy((void*)0x20000278, "\xe3\xc5\x62\x34\xa0\x57\x3d\x75\x70\x87\x3a\xff\x57\x7b\x09\x07\xbf" "\x4e\x21\xa8\x52\x39\x9a\xe2\x93\xc2\xf9\x6b\xcd\x06\x2d\xd5\x49\x77" "\x59\xf2\xd7\x85\x74\xc1\xef\x4f\x16\x49\x49\x31\x4f\x3f\x74\xdc\x4d" "\x42\x11\xd5\x01\x7f\xef\x06\xab\x45\xa0\x2b\x50\xa8", 64); memcpy((void*)0x200002b8, "\x93\x66\x70\xd9\xb7\xa0\xff\xb7\x52\x78\x16\x7b" "\x6b\x84\x61\xc9\xfe\x68\xb7\xbf\x92\x2b\x3e\x13" "\x42\x4b\x79\x98\x74\x9c\xd8\xa8", 32); *(uint64_t*)0x200002d8 = 0xb57c; *(uint64_t*)0x200002e0 = 1; syscall(__NR_ioctl, r[0], 0x4c04, 0x20000200); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }