// https://syzkaller.appspot.com/bug?id=4462682cd32aee8ff03a43c8b9be3963743bc506 // 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_writev #define __NR_writev 146 #endif #ifndef __NR_read #define __NR_read 3 #endif #ifndef __NR_mmap #define __NR_mmap 192 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 long r[1]; void loop() { memset(r, -1, sizeof(r)); syscall(__NR_mmap, 0x20000000, 0xfff000, 3, 0x32, -1, 0); memcpy((void*)0x20012ff7, "/dev/sg#", 9); r[0] = syz_open_dev(0x20012ff7, 0, 2); *(uint32_t*)0x209f0000 = 0x200e9f3d; *(uint32_t*)0x209f0004 = 0xc3; *(uint32_t*)0x209f0008 = 0x20eab000; *(uint32_t*)0x209f000c = 0; *(uint32_t*)0x209f0010 = 0x2047c000; *(uint32_t*)0x209f0014 = 0; *(uint32_t*)0x209f0018 = 0x20a3a000; *(uint32_t*)0x209f001c = 0; memcpy((void*)0x200e9f3d, "\xbb\x85\x92\xab\x23\x26\x53\x90\x06\x52\x15\xe8\xfc\x1d\x59\xd6\x32" "\xbd\x1f\xc0\xd1\xe7\xe5\x3d\x64\xfc\xb4\x2b\x94\x9e\x74\x7b\xca\x47" "\xef\xfe\xb9\x5a\x7f\x84\x69\x81\xa6\x8b\x9c\x9f\x19\x94\x2f\x6b\x45" "\x10\x2f\x72\xe6\xe1\xd2\x44\xb2\x8c\xf2\xee\x17\xd8\xa0\xb2\xa3\x17" "\x0e\x8f\x70\x35\x21\x4a\x05\x53\x32\xbe\xd0\x09\x97\x55\x78\x0c\xa2" "\x3a\xef\x05\x7f\x91\x67\xcd\x8f\x32\x16\x69\xb1\x73\xba\x8d\xb0\x09" "\x85\x00\xbd\x80\xb0\x05\xd2\x6d\x88\x40\x80\xc3\x68\xbd\x63\xef\xd5" "\x9a\xe9\xda\x02\xbd\x24\xfb\x69\x3e\x4a\xe1\xde\x9d\x23\xa7\x02\xe1" "\x28\x88\x8a\xe8\x52\xd5\x08\x04\x59\x0e\x1e\x33\xc3\x50\xb9\x03\x77" "\x52\x90\x9a\xfb\xb2\xb7\xfd\x6f\x16\xbe\xb8\x8f\x09\x65\x0a\x71\xda" "\xd9\x75\xf9\x93\x88\xc4\xfb\x0f\xa4\x1c\x29\x04\x91\x87\x1e\x49\x52" "\x97\xfa\x7c\xb2\xc0\x4c\x7c\x92", 195); syscall(__NR_writev, r[0], 0x209f0000, 4); syscall(__NR_read, r[0], 0x20185f36, 0xca); } int main() { loop(); return 0; }