// https://syzkaller.appspot.com/bug?id=a5e55a97fe9b6025a3e1ffb32990dafbb5d986c1 // 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=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); const char* reason; (void)reason; intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x20000000, "/dev/vbi#\000", 10); res = -1; res = syz_open_dev(/*dev=*/0x20000000, /*id=*/0, /*flags=*/2); if (res != -1) r[0] = res; *(uint32_t*)0x20000100 = 3; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc0045627, /*arg=*/0x20000100ul); *(uint32_t*)0x20000040 = 0; *(uint32_t*)0x20000044 = 0x8af; *(uint32_t*)0x20000048 = 0x640; *(uint32_t*)0x2000004c = 1; *(uint32_t*)0x20000050 = 2; *(uint64_t*)0x20000054 = 0xd59f83; *(uint32_t*)0x2000005c = 0x19f2; *(uint32_t*)0x20000060 = 0x3f; *(uint32_t*)0x20000064 = 4; *(uint32_t*)0x20000068 = 3; *(uint32_t*)0x2000006c = 3; *(uint32_t*)0x20000070 = 0x2800; *(uint32_t*)0x20000074 = 0x2800; *(uint32_t*)0x20000078 = 2; *(uint32_t*)0x2000007c = 0xba2; *(uint32_t*)0x20000080 = 0; *(uint32_t*)0x20000084 = 0x38; *(uint32_t*)0x20000088 = 8; *(uint32_t*)0x2000008c = -1; *(uint8_t*)0x20000090 = 0xd0; *(uint8_t*)0x20000091 = 9; memset((void*)0x20000092, 0, 46); syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc0845657, /*arg=*/0x20000040ul); return 0; }