// https://syzkaller.appspot.com/bug?id=29de44bf206913f5aea3cf4dec938ee8e8d8d838 // 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[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); intptr_t res = 0; memcpy((void*)0x20000080, "/dev/dri/card#\000", 15); res = syz_open_dev(0x20000080, 0x6c706947, 0x2100); if (res != -1) r[0] = res; memcpy((void*)0x20000000, "/dev/ion\000", 9); res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000000, 0, 0); if (res != -1) r[1] = res; *(uint64_t*)0x20000040 = 0xa925; *(uint32_t*)0x20000048 = 0x2b; *(uint32_t*)0x2000004c = 0; *(uint32_t*)0x20000050 = -1; *(uint32_t*)0x20000054 = 0; res = syscall(__NR_ioctl, r[1], 0xc0184900, 0x20000040); if (res != -1) r[2] = *(uint32_t*)0x20000050; res = syscall(__NR_dup, r[2]); if (res != -1) r[3] = res; *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = 0; *(uint32_t*)0x200000c8 = r[3]; syscall(__NR_ioctl, r[0], 0xc00c642e, 0x200000c0); return 0; }