// https://syzkaller.appspot.com/bug?id=a233f390d878f6525f60f0b15802432bd9e1fb6f // 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_mmap #define __NR_mmap 192 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 356 #endif #ifndef __NR_ioctl #define __NR_ioctl 54 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 long r[2]; void loop() { memset(r, -1, sizeof(r)); syscall(__NR_mmap, 0x20000000, 0xfff000, 0x3, 0x32, 0xffffffff, 0x0); memcpy((void*)0x2040aff5, "/dev/loop#", 11); r[0] = syz_open_dev(0x2040aff5, 0xfffffffe, 0x1); memcpy((void*)0x20614000, "\x74\x75\x6e\x08\x00\x00\x00\x00\x00\x00" "\x00\x80\x00\x00\x00\x00", 16); r[1] = syscall(__NR_memfd_create, 0x20614000, 0x0); syscall(__NR_ioctl, r[0], 0x4c00, r[1]); *(uint32_t*)0x20480f74 = 0x0; *(uint32_t*)0x20480f78 = 0x0; *(uint32_t*)0x20480f7c = 0x0; *(uint32_t*)0x20480f80 = 0x0; *(uint32_t*)0x20480f84 = 0x4d0c; *(uint32_t*)0x20480f88 = 0x0; *(uint32_t*)0x20480f8c = 0x19; *(uint32_t*)0x20480f90 = 0x19; memcpy((void*)0x20480f94, "\x6a\xd1\xac\x55\x2a\x20\x53\x84\x37\x03\x55\xd0\xe6\x76\xa5" "\x36\xa6\xa0\xd6\xcf\x25\x88\x66\xd7\x36\xe7\xe3\xae\x08\x19" "\x10\x31\xb2\x6f\xa1\x1f\xda\xd8\xfc\x15\x97\x13\x72\xc9\xc3" "\x9c\x37\xfa\xff\x14\xfe\x28\x3f\x54\x3c\xbd\x00\x6d\x78\x7e" "\x29\x7e\xe0\x88", 64); memcpy((void*)0x20480fd4, "\xa5\x22\xdd\x05\x3d\xb5\xd3\x02\xd1\x2f" "\xcf\x49\x00\x33\xac\xea\x72\xb8\xaf\xc4" "\xb4\x6b\x86\xf1\xc7\x41\xe0\x92\xda\xf3" "\x0f\x66", 32); *(uint32_t*)0x20480ff4 = 0x1; *(uint32_t*)0x20480ff8 = 0x1; *(uint32_t*)0x20480ffc = 0x0; syscall(__NR_ioctl, r[0], 0x4c02, 0x20480f74); } int main() { loop(); return 0; }