// https://syzkaller.appspot.com/bug?id=4522c4fb3896c243a66d4bda935f828e80899c2c // 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_write #define __NR_write 4 #endif #ifndef __NR_readv #define __NR_readv 145 #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*)0x20005000, "/dev/sg#", 9); r[0] = syz_open_dev(0x20005000, 0, 0x8002); memcpy((void*)0x204ef000, "\xb6\x3d\xb8\x5e\x1e\x8d\x00\x00\x00\x00\x00\x00\x00\x3e\x15\xd6\x1d" "\xcc\x43\x6a\xed\x5e\xd2\xbc\x70\x18\xce\xbc\x9b\x97\xae\x21\xb1\x4d" "\x87\x2c\x67\x8c\xe2\x2c\x9b\x16\x00\x96\xaa\x1f\xae\x1a\x11\xa8\xe4" "\x5d\x16\xe5\x8c\x19\x86\x28\x13\x41\x1e\x9f\x6c\xcc\x88\x36\x5b\x22" "\x77\x21\xff\x7b\x20\x55\x43\x68\xd5\x03\xed\x8d\xfa\xbe\x16\x16\x7c" "\x70\xae\xf0\xc1\xb0\xca\xd6\x97\x17\x21\x96\xd2\x0a\x94\x9e\x0e\x8e" "\xe4\xc2\x48\xaa\x29\x9a\xd8\xbf\x26\xfd\x8e\x10\x94\x2e\x7e\x87\xad" "\x9f\xf0\x67\xe8\x28\x9a\x3f\x7a\x05\xef\xdf\x10\x11\x88\xb6\xae\x24" "\x0d\xa4\x3f\xbf\xaa\x77\x6e\x3f\x60\xb1\xbb\x2a\xaf\xcf\x1c\x77\x04" "\xd9\xb5\xe9\xc5\xdb\xe2\x53\xc9\x03\xec\x32", 164); syscall(__NR_write, r[0], 0x204ef000, 0xa4); *(uint32_t*)0x20c74ff8 = 0x20f93fcb; *(uint32_t*)0x20c74ffc = 0x3e; syscall(__NR_readv, r[0], 0x20c74ff8, 1); } int main() { loop(); return 0; }