// https://syzkaller.appspot.com/bug?id=09df9614033546fbfc1905b80bd86fb63c60e4d2 // 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 { unsigned long nb = a1; char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(nb % 10); nb /= 10; } return open(buf, a2, 0); } } uint64_t r[6] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-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*)0x200000000040, "./file0\000", 8); res = syscall(__NR_creat, /*file=*/0x200000000040ul, /*mode=S_IXOTH|S_IWOTH|S_IXGRP|S_IXUSR*/ 0x4bul); if (res != -1) r[0] = res; syscall(__NR_close, /*fd=*/r[0]); memcpy((void*)0x200000000000, "/dev/dri/card#\000", 15); res = -1; res = syz_open_dev(/*dev=*/0x200000000000, /*id=*/2, /*flags=*/0); if (res != -1) r[1] = res; *(uint64_t*)0x200000000140 = 0; *(uint64_t*)0x200000000148 = 0x200000000380; *(uint64_t*)0x200000000150 = 0; *(uint64_t*)0x200000000158 = 0; *(uint32_t*)0x200000000160 = 0; *(uint32_t*)0x200000000164 = 2; *(uint32_t*)0x200000000168 = 0; *(uint32_t*)0x20000000016c = 0; *(uint32_t*)0x200000000170 = 0; *(uint32_t*)0x200000000174 = 0; *(uint32_t*)0x200000000178 = 0; *(uint32_t*)0x20000000017c = 0; res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc04064a0, /*arg=*/0x200000000140ul); if (res != -1) r[2] = *(uint32_t*)0x200000000380; *(uint64_t*)0x200000000300 = 0; *(uint32_t*)0x200000000308 = 0xfffffe7a; *(uint32_t*)0x20000000030c = r[2]; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc06864a1, /*arg=*/0x200000000300ul); if (res != -1) r[3] = *(uint32_t*)0x200000000310; *(uint32_t*)0x200000000600 = r[3]; *(uint32_t*)0x200000000604 = 0; *(uint32_t*)0x200000000608 = 0x1000; *(uint32_t*)0x20000000060c = 0x10000; *(uint32_t*)0x200000000610 = 3; *(uint32_t*)0x200000000624 = 0x800000; *(uint32_t*)0x200000000628 = 0x800; *(uint32_t*)0x20000000062c = 0xfffffffd; *(uint32_t*)0x200000000630 = 0; *(uint32_t*)0x200000000634 = 0; *(uint32_t*)0x200000000638 = 0x1001000; *(uint32_t*)0x20000000063c = 0xfffffffc; *(uint32_t*)0x200000000640 = 0; *(uint64_t*)0x200000000648 = 0; *(uint64_t*)0x200000000650 = 0; *(uint64_t*)0x200000000658 = 0xe8a6; *(uint64_t*)0x200000000660 = 0; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc06864ce, /*arg=*/0x200000000600ul); if (res != -1) { r[4] = *(uint32_t*)0x200000000614; r[5] = *(uint32_t*)0x200000000620; } *(uint32_t*)0x2000000001c0 = 0; *(uint32_t*)0x2000000001c4 = 0xae; *(uint32_t*)0x2000000001c8 = 0x3ff; *(uint32_t*)0x2000000001cc = 0x34325241; *(uint32_t*)0x2000000001d0 = 1; *(uint32_t*)0x2000000001d4 = r[4]; *(uint32_t*)0x2000000001d8 = 0; *(uint32_t*)0x2000000001dc = 0; *(uint32_t*)0x2000000001e0 = r[5]; *(uint32_t*)0x2000000001e4 = 0x2b8; *(uint32_t*)0x2000000001e8 = 0; *(uint32_t*)0x2000000001ec = 0; *(uint32_t*)0x2000000001f0 = 0; *(uint32_t*)0x2000000001f4 = 0; *(uint32_t*)0x2000000001f8 = 0; *(uint32_t*)0x2000000001fc = 0; *(uint32_t*)0x200000000200 = 1; *(uint64_t*)0x200000000208 = 0; *(uint64_t*)0x200000000210 = 0; *(uint64_t*)0x200000000218 = 0; *(uint64_t*)0x200000000220 = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc06864b8, /*arg=*/0x2000000001c0ul); return 0; }