// https://syzkaller.appspot.com/bug?id=6fa4aeaa1f34d56f15c103cf37def79ddff36173 // 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, /*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*)0x20000000, "/dev/video#\000", 12); res = -1; res = syz_open_dev(/*dev=*/0x20000000, /*id=*/0, /*flags=*/2); if (res != -1) r[0] = res; *(uint32_t*)0x20000280 = 0x5f25; *(uint32_t*)0x20000284 = 1; *(uint32_t*)0x20000288 = 2; *(uint32_t*)0x2000028c = 0; *(uint8_t*)0x20000290 = 0; memset((void*)0x20000291, 0, 3); syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc0145608, /*arg=*/0x20000280ul); *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 1; *(uint32_t*)0x200002c8 = 4; *(uint32_t*)0x200002cc = 0; *(uint32_t*)0x200002d0 = 0; *(uint64_t*)0x200002d8 = 0x77359400; *(uint64_t*)0x200002e0 = 0; *(uint32_t*)0x200002e8 = 0; *(uint32_t*)0x200002ec = 0; *(uint8_t*)0x200002f0 = 0; *(uint8_t*)0x200002f1 = 0; *(uint8_t*)0x200002f2 = 0; *(uint8_t*)0x200002f3 = 0; memcpy((void*)0x200002f4, "\xd2\x88\xae\x5f", 4); *(uint32_t*)0x200002f8 = 0; *(uint32_t*)0x200002fc = 2; *(uint64_t*)0x20000300 = 0; *(uint32_t*)0x20000308 = 0x2a302c; *(uint32_t*)0x2000030c = 0; *(uint32_t*)0x20000310 = -1; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc058565d, /*arg=*/0x200002c0ul); return 0; }