// https://syzkaller.appspot.com/bug?id=8e5fc278ee145ccf54cd1fc629f11653747f7194 // 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, 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 = 0x0 (8 bytes) // flags: open_flags = 0x0 (8 bytes) // ] // returns fd_dri memcpy((void*)0x200000000000, "/dev/dri/card#\000", 15); res = -1; res = syz_open_dev(/*dev=*/0x200000000000, /*id=*/0, /*flags=*/0); if (res != -1) r[0] = res; // 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 = 0xd21 (8 bytes) // flags: open_flags = 0x0 (8 bytes) // ] // returns fd_dri memcpy((void*)0x2000000008c0, "/dev/dri/card#\000", 15); res = -1; res = syz_open_dev(/*dev=*/0x2000000008c0, /*id=*/0xd21, /*flags=*/0); if (res != -1) r[1] = res; // ioctl$DRM_IOCTL_MODE_GETRESOURCES arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc04064a0 (4 bytes) // arg: ptr[inout, drm_mode_card_res] { // drm_mode_card_res { // fbid: nil // crtcid: ptr[out, array[drm_crtc_id]] { // array[drm_crtc_id] { // drm_crtc_id (resource) // } // } // connid: nil // encid: nil // nfbid: len = 0x0 (4 bytes) // ncrtcid: len = 0x1 (4 bytes) // nconnid: len = 0x0 (4 bytes) // nencid: len = 0x0 (4 bytes) // maxw: const = 0x0 (4 bytes) // maxh: const = 0x0 (4 bytes) // minw: const = 0x0 (4 bytes) // minh: const = 0x0 (4 bytes) // } // } // ] *(uint64_t*)0x2000000001c0 = 0; *(uint64_t*)0x2000000001c8 = 0x2000000000c0; *(uint64_t*)0x2000000001d0 = 0; *(uint64_t*)0x2000000001d8 = 0; *(uint32_t*)0x2000000001e0 = 0; *(uint32_t*)0x2000000001e4 = 1; *(uint32_t*)0x2000000001e8 = 0; *(uint32_t*)0x2000000001ec = 0; *(uint32_t*)0x2000000001f0 = 0; *(uint32_t*)0x2000000001f4 = 0; *(uint32_t*)0x2000000001f8 = 0; *(uint32_t*)0x2000000001fc = 0; res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc04064a0, /*arg=*/0x2000000001c0ul); if (res != -1) r[2] = *(uint32_t*)0x2000000000c0; // ioctl$DRM_IOCTL_MODE_GETCRTC arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc06864a1 (4 bytes) // arg: ptr[inout, drm_mode_crtc$DRM_IOCTL_MODE_GETCRTC] { // drm_mode_crtc$DRM_IOCTL_MODE_GETCRTC { // set_connectors_ptr: nil // count_connectors: len = 0xffffffca (4 bytes) // crtc_id: drm_crtc_id (resource) // fb_id: drm_fb_id (resource) // x: int32 = 0x0 (4 bytes) // y: int32 = 0x0 (4 bytes) // gamma_size: int32 = 0x0 (4 bytes) // mode_valid: int32 = 0x0 (4 bytes) // mode: drm_mode_modeinfo { // clock: int32 = 0x0 (4 bytes) // hdisplay: int16 = 0x0 (2 bytes) // hsync_start: int16 = 0x0 (2 bytes) // hsync_end: int16 = 0x0 (2 bytes) // htotal: int16 = 0x0 (2 bytes) // hskew: int16 = 0x0 (2 bytes) // vdisplay: int16 = 0x0 (2 bytes) // vsync_start: int16 = 0x0 (2 bytes) // vsync_end: int16 = 0x0 (2 bytes) // vtotal: int16 = 0x0 (2 bytes) // vscan: int16 = 0x0 (2 bytes) // vrefresh: int32 = 0x0 (4 bytes) // flags: int32 = 0x0 (4 bytes) // type: int32 = 0x0 (4 bytes) // name: buffer: (DirOut) // } // } // } // ] *(uint64_t*)0x200000000380 = 0; *(uint32_t*)0x200000000388 = 0xffffffca; *(uint32_t*)0x20000000038c = r[2]; res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc06864a1, /*arg=*/0x200000000380ul); if (res != -1) r[3] = *(uint32_t*)0x200000000390; // ioctl$DRM_IOCTL_MODE_GETFB2 arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc06864ce (4 bytes) // arg: ptr[inout, drm_mode_fb_cmd2$DRM_IOCTL_MODE_GETFB2] { // drm_mode_fb_cmd2$DRM_IOCTL_MODE_GETFB2 { // fb_id: drm_fb_id (resource) // width: int32 = 0xe (4 bytes) // height: int32 = 0x7f (4 bytes) // pixel_format: int32 = 0x0 (4 bytes) // flags: drm_mode_fb_flags = 0x0 (4 bytes) // handles: array[drm_gem_handle] { // drm_gem_handle (resource) // drm_gem_handle (resource) // drm_gem_handle (resource) // drm_gem_handle (resource) // } // pitches: array[int32] { // int32 = 0x0 (4 bytes) // int32 = 0x29 (4 bytes) // int32 = 0x2 (4 bytes) // int32 = 0x0 (4 bytes) // } // offsets: array[int32] { // int32 = 0x0 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x0 (4 bytes) // int32 = 0x0 (4 bytes) // } // pad = 0x0 (4 bytes) // modifier: array[int64] { // int64 = 0x0 (8 bytes) // int64 = 0x0 (8 bytes) // int64 = 0xfffffffffffffffd (8 bytes) // int64 = 0x0 (8 bytes) // } // } // } // ] *(uint32_t*)0x200000000440 = r[3]; *(uint32_t*)0x200000000444 = 0xe; *(uint32_t*)0x200000000448 = 0x7f; *(uint32_t*)0x20000000044c = 0; *(uint32_t*)0x200000000450 = 0; *(uint32_t*)0x200000000464 = 0; *(uint32_t*)0x200000000468 = 0x29; *(uint32_t*)0x20000000046c = 2; *(uint32_t*)0x200000000470 = 0; *(uint32_t*)0x200000000474 = 0; *(uint32_t*)0x200000000478 = 0; *(uint32_t*)0x20000000047c = 0; *(uint32_t*)0x200000000480 = 0; *(uint64_t*)0x200000000488 = 0; *(uint64_t*)0x200000000490 = 0; *(uint64_t*)0x200000000498 = 0xfffffffffffffffd; *(uint64_t*)0x2000000004a0 = 0; res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc06864ce, /*arg=*/0x200000000440ul); if (res != -1) r[4] = *(uint32_t*)0x200000000454; // ioctl$DRM_IOCTL_MODE_CREATE_DUMB arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc02064b2 (4 bytes) // arg: ptr[inout, drm_mode_create_dumb] { // drm_mode_create_dumb { // height: int32 = 0x83ff (4 bytes) // width: int32 = 0x2 (4 bytes) // bpp: int32 = 0xb5 (4 bytes) // flags: const = 0x0 (4 bytes) // handle: drm_dumb_handle (resource) // pitch: int32 = 0x0 (4 bytes) // size: int64 = 0x0 (8 bytes) // } // } // ] *(uint32_t*)0x200000000340 = 0x83ff; *(uint32_t*)0x200000000344 = 2; *(uint32_t*)0x200000000348 = 0xb5; *(uint32_t*)0x20000000034c = 0; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc02064b2, /*arg=*/0x200000000340ul); // ioctl$DRM_IOCTL_PRIME_HANDLE_TO_FD arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc00c642d (4 bytes) // arg: ptr[inout, drm_prime_handle$DRM_IOCTL_PRIME_HANDLE_TO_FD] { // drm_prime_handle$DRM_IOCTL_PRIME_HANDLE_TO_FD { // handle: drm_gem_handle (resource) // flags: dup_flags = 0x0 (4 bytes) // fd: fd_dri (resource) // } // } // ] *(uint32_t*)0x200000000080 = r[4]; *(uint32_t*)0x200000000084 = 0; res = syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc00c642d, /*arg=*/0x200000000080ul); if (res != -1) r[5] = *(uint32_t*)0x200000000088; // ioctl$DRM_IOCTL_PRIME_FD_TO_HANDLE arguments: [ // fd: fd_dri (resource) // cmd: const = 0xc00c642e (4 bytes) // arg: ptr[inout, drm_prime_handle$DRM_IOCTL_PRIME_FD_TO_HANDLE] { // drm_prime_handle$DRM_IOCTL_PRIME_FD_TO_HANDLE { // handle: drm_gem_handle (resource) // flags: const = 0x0 (4 bytes) // fd: fd_dri (resource) // } // } // ] *(uint32_t*)0x200000000304 = 0; *(uint32_t*)0x200000000308 = r[5]; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc00c642e, /*arg=*/0x200000000300ul); return 0; }