// https://syzkaller.appspot.com/bug?id=b67883c5ca3f239bc1e504a29f0e7b37ed42b376 // 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); } } uint64_t r[1] = {0xffffffffffffffff}; void loop() { long res = 0; memcpy((void*)0x20000140, "/dev/loop#", 11); res = syz_open_dev(0x20000140, 0, 0); if (res != -1) r[0] = res; *(uint32_t*)0x200001c0 = 0; *(uint32_t*)0x200001c4 = 0; *(uint32_t*)0x200001c8 = 0; *(uint32_t*)0x200001cc = 0; *(uint32_t*)0x200001d0 = 3; *(uint32_t*)0x200001d4 = 0xfffffffe; *(uint32_t*)0x200001d8 = 0x19; *(uint32_t*)0x200001dc = 0x18; memcpy((void*)0x200001e0, "\x00\x00\x00\x00\x01\x00\x00\x00\x00\xe5\x4c\x16\x62\x0f\x00\x00\x00" "\x65\x00\x00\x00\xed\xff\x00\x00\x7d\xb0\xe6\x33\x0e\xe7\xf9\xb3\x19" "\xd8\x00\x00\x18\xe5\x8d\x1c\x43\x47\x30\x00\xe1\x50\x26\xfb\x00\x00" "\x00\x80\x01\xd1\xa7\x33\x5d\x5b\xff\xff\x00\x01\xd7", 64); memcpy((void*)0x20000220, "\xce\xe4\x00\x05\x00\x35\x00\xf7\xff\x00\x02\xff" "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x81\x00\x04" "\xdc\x01\x86\x7d\xff\xfe\x02\x00", 32); *(uint64_t*)0x20000240 = 0x3ff; *(uint64_t*)0x20000248 = 0; *(uint32_t*)0x20000250 = 0; syscall(__NR_ioctl, r[0], 0xc0481273, 0x200001c0); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }