// https://syzkaller.appspot.com/bug?id=abb6cc54bd2802dfdeb0978f7adf870325b80f92 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #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); } } static void test(); void loop() { while (1) { test(); } } long r[1]; void test() { memset(r, -1, sizeof(r)); syscall(__NR_mmap, 0x20000000ul, 0xfff000ul, 0x3ul, 0x32ul, 0xfffffffffffffffful, 0x0ul); memcpy((void*)0x20fa6000, "/dev/sg#", 9); r[0] = syz_open_dev(0x20fa6000ul, 0x0ul, 0x0ul); *(uint32_t*)0x2098f000 = (uint32_t)0x0; *(uint16_t*)0x2098f004 = (uint16_t)0x0; *(uint8_t*)0x2098f006 = (uint8_t)0x0; *(uint8_t*)0x2098f007 = (uint8_t)0x0; *(uint8_t*)0x2098f008 = (uint8_t)0x0; *(uint8_t*)0x2098f009 = (uint8_t)0x0; *(uint8_t*)0x2098f00a = (uint8_t)0x0; *(uint8_t*)0x2098f00b = (uint8_t)0x0; *(uint8_t*)0x2098f00c = (uint8_t)0x0; *(uint8_t*)0x2098f00d = (uint8_t)0x0; *(uint8_t*)0x2098f00e = (uint8_t)0x0; *(uint8_t*)0x2098f00f = (uint8_t)0x0; *(uint64_t*)0x2098f010 = (uint64_t)0x0; *(uint32_t*)0x2098f018 = (uint32_t)0x0; *(uint16_t*)0x2098f01c = (uint16_t)0x0; *(uint8_t*)0x2098f01e = (uint8_t)0x0; *(uint8_t*)0x2098f01f = (uint8_t)0x0; *(uint8_t*)0x2098f020 = (uint8_t)0x0; *(uint8_t*)0x2098f021 = (uint8_t)0x0; *(uint8_t*)0x2098f022 = (uint8_t)0x0; *(uint8_t*)0x2098f023 = (uint8_t)0x0; *(uint8_t*)0x2098f024 = (uint8_t)0x0; *(uint8_t*)0x2098f025 = (uint8_t)0xfffffffffffffffc; *(uint8_t*)0x2098f026 = (uint8_t)0x0; *(uint8_t*)0x2098f027 = (uint8_t)0x0; *(uint64_t*)0x2098f028 = (uint64_t)0x10001; *(uint32_t*)0x2098f030 = (uint32_t)0x0; *(uint16_t*)0x2098f034 = (uint16_t)0x0; *(uint8_t*)0x2098f036 = (uint8_t)0x0; *(uint8_t*)0x2098f037 = (uint8_t)0x0; *(uint8_t*)0x2098f038 = (uint8_t)0x0; *(uint8_t*)0x2098f039 = (uint8_t)0x0; *(uint8_t*)0x2098f03a = (uint8_t)0x0; *(uint8_t*)0x2098f03b = (uint8_t)0x0; *(uint8_t*)0x2098f03c = (uint8_t)0x0; *(uint8_t*)0x2098f03d = (uint8_t)0x0; *(uint8_t*)0x2098f03e = (uint8_t)0x0; *(uint8_t*)0x2098f03f = (uint8_t)0x0; *(uint64_t*)0x2098f040 = (uint64_t)0x0; *(uint32_t*)0x2098f048 = (uint32_t)0x0; *(uint32_t*)0x2098f04c = (uint32_t)0x0; *(uint32_t*)0x2098f050 = (uint32_t)0x0; *(uint32_t*)0x2098f054 = (uint32_t)0x0; *(uint32_t*)0x2098f058 = (uint32_t)0x0; *(uint32_t*)0x2098f05c = (uint32_t)0x0; *(uint32_t*)0x2098f060 = (uint32_t)0x0; *(uint32_t*)0x2098f064 = (uint32_t)0x0; *(uint32_t*)0x2098f068 = (uint32_t)0x0; *(uint32_t*)0x2098f06c = (uint32_t)0x0; syscall(__NR_ioctl, r[0], 0xc0481273ul, 0x2098f000ul); } int main() { loop(); return 0; }