// https://syzkaller.appspot.com/bug?id=d94c4cff9ee2e4f97b273f1996039917302d6488 // 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[6] = { 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0x0, 0x0}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/7ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); intptr_t res = 0; memcpy((void*)0x20000080, "/dev/dri/card#\000", 15); res = -1; res = syz_open_dev(/*dev=*/0x20000080, /*id=*/1, /*flags=*/0); if (res != -1) r[0] = res; memcpy((void*)0x20000000, "/dev/dri/card#\000", 15); res = -1; res = syz_open_dev(/*dev=*/0x20000000, /*id=*/1, /*flags=*/0); if (res != -1) r[1] = res; *(uint64_t*)0x20000200 = 0; *(uint64_t*)0x20000208 = 0x20000100; *(uint64_t*)0x20000210 = 0; *(uint64_t*)0x20000218 = 0; *(uint32_t*)0x20000220 = 0; *(uint32_t*)0x20000224 = 1; *(uint32_t*)0x20000228 = 0; *(uint32_t*)0x2000022c = 0; *(uint32_t*)0x20000230 = 0; *(uint32_t*)0x20000234 = 0; *(uint32_t*)0x20000238 = 0; *(uint32_t*)0x2000023c = 0; res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc04064a0, /*arg=*/0x20000200ul); if (res != -1) r[2] = *(uint32_t*)0x20000100; memcpy((void*)0x20000000, "/dev/dri/card#\000", 15); res = -1; res = syz_open_dev(/*dev=*/0x20000000, /*id=*/1, /*flags=*/0); if (res != -1) r[3] = res; *(uint64_t*)0x20000200 = 0; *(uint64_t*)0x20000208 = 0x20000100; *(uint64_t*)0x20000210 = 0; *(uint64_t*)0x20000218 = 0; *(uint32_t*)0x20000220 = 0; *(uint32_t*)0x20000224 = 1; *(uint32_t*)0x20000228 = 0; *(uint32_t*)0x2000022c = 0; *(uint32_t*)0x20000230 = 0; *(uint32_t*)0x20000234 = 0; *(uint32_t*)0x20000238 = 0; *(uint32_t*)0x2000023c = 0; res = syscall(__NR_ioctl, /*fd=*/r[3], /*cmd=*/0xc04064a0, /*arg=*/0x20000200ul); if (res != -1) r[4] = *(uint32_t*)0x20000100; *(uint64_t*)0x20000080 = 0; *(uint32_t*)0x20000088 = 0; *(uint32_t*)0x2000008c = r[4]; res = syscall(__NR_ioctl, /*fd=*/r[3], /*cmd=*/0xc06864a1, /*arg=*/0x20000080ul); if (res != -1) r[5] = *(uint32_t*)0x20000090; *(uint64_t*)0x20000180 = 0; *(uint32_t*)0x20000188 = 0; *(uint32_t*)0x2000018c = r[2]; *(uint32_t*)0x20000190 = r[5]; *(uint32_t*)0x20000194 = 0x1ff; *(uint32_t*)0x20000198 = 0; *(uint32_t*)0x2000019c = 0xffff; *(uint32_t*)0x200001a0 = 9; *(uint32_t*)0x200001a4 = 0x80; *(uint16_t*)0x200001a8 = 0x394; *(uint16_t*)0x200001aa = 0x53; *(uint16_t*)0x200001ac = 0; *(uint16_t*)0x200001ae = 0x80; *(uint16_t*)0x200001b0 = 0x8001; *(uint16_t*)0x200001b2 = 3; *(uint16_t*)0x200001b4 = 0xf4e6; *(uint16_t*)0x200001b6 = 0x200; *(uint16_t*)0x200001b8 = 0x8000; *(uint16_t*)0x200001ba = 0x400; *(uint32_t*)0x200001bc = 3; *(uint32_t*)0x200001c0 = 8; *(uint32_t*)0x200001c4 = 0; memcpy((void*)0x200001c8, "\x82\x0b\x7b\x78\xd0\x55\x10\x15\xd1\x74\xdc\x75\xbf\xc4\x45\x5b\x6f" "\xf7\x69\x45\x28\x93\xe0\xa7\xf9\x05\xf8\xd7\xda\x9e\x7b\x3f", 32); syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc06864a2, /*arg=*/0x20000180ul); return 0; }