// https://syzkaller.appspot.com/bug?id=f694c962e45fb574615f5ec130dad9956c9d68e5 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include static long syz_create_resource(volatile long val) { return val; } uint64_t r[2] = {0x0, 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 69 6e 67 00} (length 0xa) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000000, "./tracing\000", 10); 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 69 6e 67 00} (length 0xa) // } // 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*)0x200000000200, "./tracing\000", 10); memcpy((void*)0x200000000300, "tracefs\000", 8); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000200ul, /*type=*/0x200000000300ul, /*flags=*/0ul, /*data=*/0ul); // syz_create_resource$binfmt arguments: [ // file: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // ] // returns ptr_binfmt_file memcpy((void*)0x200000000400, "./file0\000", 8); res = -1; res = syz_create_resource(/*file=*/0x200000000400); if (res != -1) r[0] = res; // openat$binfmt arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr_binfmt_file (resource) // flags: const = 0x241 (4 bytes) // mode: const = 0x1ff (2 bytes) // ] // returns fd_binfmt syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/r[0], /*flags=*/0x241, /*mode=*/0x1ff); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 69 6e 67 2f 75 70 72 6f 62 65 5f 65 76 65 // 6e 74 73 00} (length 0x18) // } // flags: open_flags = 0x1 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000600, "./tracing/uprobe_events\000", 24); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000600ul, /*flags=O_WRONLY*/ 1, /*mode=*/0); if (res != -1) r[1] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {70 3a 6d 79 65 76 65 6e 74 20 2e 2f 66 69 6c 65 30 3a 30 78 // 31} (length 0x15) // } // count: len = 0x15 (8 bytes) // ] memcpy((void*)0x200000000700, "p:myevent ./file0:0x1", 21); syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000000700ul, /*count=*/0x15ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 69 6e 67 2f 65 76 65 6e 74 73 2f 75 70 72 // 6f 62 65 73 2f 6d 79 65 76 65 6e 74 2f 65 6e 61 62 6c 65 00} (length // 0x28) // } // flags: open_flags = 0x1 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000800, "./tracing/events/uprobes/myevent/enable\000", 40); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000800ul, /*flags=O_WRONLY*/ 1, /*mode=*/0); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 74 72 61 63 69 6e 67 2f 75 70 72 6f 62 65 5f 65 76 65 // 6e 74 73 00} (length 0x18) // } // flags: open_flags = 0xe242 (4 bytes) // mode: open_mode = 0x48 (2 bytes) // ] // returns fd memcpy((void*)0x200000000040, "./tracing/uprobe_events\000", 24); syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000040ul, /*flags=O_TRUNC|O_LARGEFILE|O_DIRECT|O_CREAT|FASYNC|0x2*/ 0xe242, /*mode=S_IXGRP|S_IXUSR*/ 0x48); return 0; }