// https://syzkaller.appspot.com/bug?id=a5954455fcfa51c29ca2ab55b203076337e1c770 // 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#\x00", 15); res = syz_open_dev(0x20000080, 0xc72f, 0); if (res != -1) r[0] = res; *(uint64_t*)0x20000100 = 0; *(uint32_t*)0x20000108 = 0; *(uint32_t*)0x2000010c = 0x1f; *(uint32_t*)0x20000110 = 6; *(uint32_t*)0x20000114 = 4; *(uint32_t*)0x20000118 = 8; *(uint32_t*)0x2000011c = 0x64; *(uint32_t*)0x20000120 = 0; *(uint16_t*)0x20000124 = 0xdb7; *(uint16_t*)0x20000126 = 6; *(uint16_t*)0x20000128 = 0xf000; *(uint16_t*)0x2000012a = 0x8e; *(uint16_t*)0x2000012c = 3; *(uint16_t*)0x2000012e = 9; *(uint16_t*)0x20000130 = 0x401; *(uint16_t*)0x20000132 = 1; *(uint16_t*)0x20000134 = 1; *(uint16_t*)0x20000136 = 1; *(uint16_t*)0x20000138 = 9; *(uint32_t*)0x2000013c = 6; *(uint32_t*)0x20000140 = 0x88a; memcpy((void*)0x20000144, "\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, 0x20000100); return 0; }