// https://syzkaller.appspot.com/bug?id=6dcd14a729df98f989c7b76d254226ae67084efd // 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_read #define __NR_read 3 #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*)0x20265ff7, "/dev/sg#", 9); r[0] = syz_open_dev(0x20265ff7, 0, 2); *(uint8_t*)0x20ef7fa5 = 0; *(uint8_t*)0x20ef7fa6 = 0; *(uint16_t*)0x20ef7fa7 = 0; *(uint16_t*)0x20ef7fa9 = 0; *(uint16_t*)0x20ef7fab = 0; *(uint16_t*)0x20ef7fad = 0; *(uint8_t*)0x20ef7faf = 0; *(uint8_t*)0x20ef7fb0 = 0; *(uint8_t*)0x20ef7fb1 = 0; *(uint8_t*)0x20ef7fb2 = 0; *(uint8_t*)0x20ef7fb3 = 0; *(uint8_t*)0x20ef7fb4 = 0; *(uint8_t*)0x20ef7fb5 = 0xaa; *(uint8_t*)0x20ef7fb6 = 0xaa; *(uint8_t*)0x20ef7fb7 = 0xaa; *(uint8_t*)0x20ef7fb8 = 0xaa; *(uint8_t*)0x20ef7fb9 = 0xaa; *(uint8_t*)0x20ef7fba = 0; *(uint16_t*)0x20ef7fbb = htobe16(0); *(uint16_t*)0x20ef7fbd = htobe16(0x16); *(uint8_t*)0x20ef7fbf = 0; *(uint8_t*)0x20ef7fc0 = 0; memcpy((void*)0x20ef7fc1, "\xc2", 1); memcpy((void*)0x20ef7fc2, "\xc1\x20\x70", 3); *(uint16_t*)0x20ef7fc5 = htobe16(0); memcpy((void*)0x20ef7fc7, "\x4a\x5f\xba\x5b\x0e\xca\xe2\xa2\xf9\x95\xfb\xcc\xba\xf3", 14); syscall(__NR_write, r[0], 0x20ef7fa5, 0x30); syscall(__NR_read, r[0], 0x205c5fc7, 0); } int main() { loop(); return 0; }