// https://syzkaller.appspot.com/bug?id=f8d5ebe3bfc477f3b8bfb3a249823ed07878801c // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*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=*/0x1000, /*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)) { } // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 65 00} (length 0x8) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000000, "./trace\000", 8); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1fful); // mount arguments: [ // src: nil // dst: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 65 00} (length 0x8) // } // type: ptr[in, buffer] { // buffer: {74 72 61 63 65 66 73 00} (length 0x8) // } // flags: mount_flags = 0x0 (8 bytes) // data: nil // ] memcpy((void*)0x200000000000, "./trace\000", 8); memcpy((void*)0x200000000040, "tracefs\000", 8); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000000ul, /*type=*/0x200000000040ul, /*flags=*/0ul, /*data=*/0ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 65 2f 65 76 65 6e 74 73 2f 64 77 63 33 2f // 64 77 63 33 5f 63 74 72 6c 5f 72 65 71 2f 69 6e 6a 65 63 74 00} // (length 0x29) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000080, "./trace/events/dwc3/dwc3_ctrl_req/inject\000", 41); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000080ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[0] = res; // write arguments: [ // fd: fd (resource) // buf: nil // count: len = 0x0 (8 bytes) // ] syscall(__NR_write, /*fd=*/r[0], /*buf=*/0ul, /*count=*/0ul); // mkdirat arguments: [ // fd: fd_dir (resource) // path: ptr[in, buffer] { // buffer: {2e 2f 64 65 62 75 67 00} (length 0x8) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000000, "./debug\000", 8); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/ 0x1fful); // mount arguments: [ // src: nil // dst: ptr[in, buffer] { // buffer: {2e 2f 64 65 62 75 67 00} (length 0x8) // } // type: ptr[in, buffer] { // buffer: {64 65 62 75 67 66 73 00} (length 0x8) // } // flags: mount_flags = 0x0 (8 bytes) // data: nil // ] memcpy((void*)0x200000000080, "./debug\000", 8); memcpy((void*)0x2000000000c0, "debugfs\000", 8); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000080ul, /*type=*/0x2000000000c0ul, /*flags=*/0ul, /*data=*/0ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 64 65 62 75 67 2f 74 72 61 63 69 6e 67 2f 74 72 61 63 // 65 5f 6d 61 72 6b 65 72 00} (length 0x1d) // } // flags: open_flags = 0x1 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000200, "./debug/tracing/trace_marker\000", 29); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000200ul, /*flags=O_WRONLY*/ 1, /*mode=*/0); if (res != -1) r[1] = res; // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 64 65 62 75 67 2f 74 72 61 63 69 6e 67 2f 74 72 61 63 // 65 5f 70 69 70 65 00} (length 0x1b) // } // flags: open_flags = 0x800 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000400, "./debug/tracing/trace_pipe\000", 27); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000400ul, /*flags=O_NONBLOCK*/ 0x800, /*mode=*/0); if (res != -1) r[2] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 // 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 // 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 // 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 // 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 // 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41} (length 0x80) // } // count: len = 0x1fc7 (8 bytes) // ] memset((void*)0x200000001000, 65, 128); syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000001000ul, /*count=*/0x1fc7ul); // read arguments: [ // fd: fd (resource) // buf: ptr[out, buffer] { // buffer: (DirOut) // } // count: len = 0x2000 (8 bytes) // ] syscall(__NR_read, /*fd=*/r[2], /*buf=*/0x200000004000ul, /*count=*/0x2000ul); return 0; }