// https://syzkaller.appspot.com/bug?id=a3878154d644f046cccf305a1f9ac723d25015bf // 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 & ~O_CREAT, 0); } } uint64_t r[1] = {0xffffffffffffffff}; 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)) { } // syz_open_dev$dri arguments: [ // dev: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 64 72 69 2f 63 61 72 64 23 00} (length 0xf) // } // id: intptr = 0x2 (8 bytes) // flags: open_flags = 0x2000 (8 bytes) // ] // returns fd_dri memcpy((void*)0x200000000000, "/dev/dri/card#\000", 15); res = -1; res = syz_open_dev(/*dev=*/0x200000000000, /*id=*/2, /*flags=FASYNC*/ 0x2000); if (res != -1) r[0] = res; // ioctl$DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc01864cd (4 bytes) // arg: ptr[in, drm_syncobj_timeline_array] { // drm_syncobj_timeline_array { // handles: ptr[in, array[drm_syncobj]] { // array[drm_syncobj] { // drm_syncobj (resource) // drm_syncobj (resource) // drm_syncobj (resource) // drm_syncobj (resource) // drm_syncobj (resource) // drm_syncobj (resource) // drm_syncobj (resource) // drm_syncobj (resource) // } // } // points: nil // count_handles: len = 0x40000067 (4 bytes) // flags: drm_syncobj_query_flags = 0x0 (4 bytes) // } // } // ] *(uint64_t*)0x2000000002c0 = 0x200000000280; *(uint32_t*)0x200000000280 = 0; *(uint32_t*)0x200000000284 = 0; *(uint32_t*)0x200000000288 = 0; *(uint32_t*)0x20000000028c = 0; *(uint32_t*)0x200000000290 = 0; *(uint32_t*)0x200000000294 = 0; *(uint32_t*)0x200000000298 = 0; *(uint32_t*)0x20000000029c = 0; *(uint64_t*)0x2000000002c8 = 0; *(uint32_t*)0x2000000002d0 = 0x40000067; *(uint32_t*)0x2000000002d4 = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc01864cd, /*arg=*/0x2000000002c0ul); return 0; }