// https://syzkaller.appspot.com/bug?id=46f76391fe0b58c2cc790c8e6f82bdf5b41d0354 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include static long syz_open_dev(volatile long a0, volatile long a1, volatile long 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) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); intptr_t res = 0; memcpy((void*)0x200000c0, "/dev/swradio#\000", 14); res = -1; res = syz_open_dev(0x200000c0, 1, 2); if (res != -1) r[0] = res; *(uint32_t*)0x20000140 = 1; *(uint32_t*)0x20000144 = 0; *(uint32_t*)0x20000148 = 4; *(uint32_t*)0x2000014c = 0; *(uint32_t*)0x20000150 = 0; *(uint64_t*)0x20000158 = 0; *(uint64_t*)0x20000160 = 0; *(uint32_t*)0x20000168 = 0; *(uint32_t*)0x2000016c = 0; *(uint8_t*)0x20000170 = 0; *(uint8_t*)0x20000171 = 0; *(uint8_t*)0x20000172 = 0; *(uint8_t*)0x20000173 = 0; memcpy((void*)0x20000174, "\xd2\xee\x6a\x19", 4); *(uint32_t*)0x20000178 = 0; *(uint32_t*)0x2000017c = 0; *(uint32_t*)0x20000180 = -1; *(uint32_t*)0x20000188 = 0; *(uint32_t*)0x2000018c = 0; *(uint32_t*)0x20000190 = -1; syscall(__NR_ioctl, -1, 0xc058560f, 0x20000140ul); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 9; *(uint32_t*)0x20000108 = 0; *(uint32_t*)0x2000010c = -1; *(uint32_t*)0x20000110 = 0; *(uint64_t*)0x20000118 = 0; syscall(__NR_ioctl, r[0], 0xc0505611, 0x20000100ul); return 0; }