// https://syzkaller.appspot.com/bug?id=feb49e622c3d0ca5ff931e55e2310f96a4d0231e // 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(long a0, long a1, 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, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; memcpy((void*)0x20000080, "/dev/dri/card#\000", 15); res = syz_open_dev(0x20000080, 0xc72f, 0); if (res != -1) r[0] = res; *(uint64_t*)0x20000000 = 0; *(uint32_t*)0x20000008 = 0; *(uint32_t*)0x2000000c = 0x1f; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = 0; *(uint32_t*)0x20000018 = 0; *(uint32_t*)0x2000001c = 0; *(uint32_t*)0x20000020 = 0; *(uint16_t*)0x20000024 = 0; *(uint16_t*)0x20000026 = 0; *(uint16_t*)0x20000028 = 0; *(uint16_t*)0x2000002a = 0; *(uint16_t*)0x2000002c = 0; *(uint16_t*)0x2000002e = 0; *(uint16_t*)0x20000030 = 0; *(uint16_t*)0x20000032 = 0; *(uint16_t*)0x20000034 = 0; *(uint16_t*)0x20000036 = 0; *(uint16_t*)0x20000038 = 0; *(uint32_t*)0x2000003c = 0; *(uint32_t*)0x20000040 = 0; memcpy((void*)0x20000044, "\x77\x10\x0b\x6a\x1c\xc0\x76\xa1\x5a\xd9\xf0\x55" "\x2d\x5b\x12\xbf\xc3\x38\xe5\x26\x9b\x12\xac\x2a" "\x4e\xe4\x20\x2c\x64\x12\x2b\x0a", 32); syscall(__NR_ioctl, r[0], 0xc06864a2, 0x20000000); return 0; }