// https://syzkaller.appspot.com/bug?id=7aaabbd527d1e5fff779bc04777336a56c4828c9 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #ifndef __NR_close_range #define __NR_close_range 436 #endif #ifndef __NR_seccomp #define __NR_seccomp 317 #endif uint64_t r[2] = {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 73 79 73 00} (length 0x6) // } // mode: open_mode = 0x1ff (8 bytes) // ] memcpy((void*)0x200000000000, "./sys\000", 6); 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 73 79 73 00} (length 0x6) // } // type: ptr[in, buffer] { // buffer: {73 79 73 66 73 00} (length 0x6) // } // flags: mount_flags = 0x0 (8 bytes) // data: nil // ] memcpy((void*)0x200000000000, "./sys\000", 6); memcpy((void*)0x2000000000c0, "sysfs\000", 6); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000000ul, /*type=*/0x2000000000c0ul, /*flags=*/0ul, /*data=*/0ul); // openat arguments: [ // fd: fd_dir (resource) // file: ptr[in, buffer] { // buffer: {2e 2f 73 79 73 2f 63 6c 61 73 73 2f 70 74 70 2f 70 74 70 30 // 2f 6e 5f 76 63 6c 6f 63 6b 73 00} (length 0x1f) // } // flags: open_flags = 0x2 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200000000100, "./sys/class/ptp/ptp0/n_vclocks\000", 31); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000100ul, /*flags=O_RDWR*/ 2, /*mode=*/0); if (res != -1) r[0] = res; // write arguments: [ // fd: fd (resource) // buf: ptr[in, buffer] { // buffer: {31} (length 0x1) // } // count: len = 0x1 (8 bytes) // ] memset((void*)0x200000000200, 49, 1); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000200ul, /*count=*/1ul); // write$cgroup_pid arguments: [ // fd: fd_cgroup_pid (resource) // buf: ptr[in, pid] { // pid (resource) // } // len: bytesize = 0x12 (8 bytes) // ] sprintf((char*)0x200000000180, "0x%016llx", (long long)0); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000180ul, /*len=*/0x12ul); // seccomp$SECCOMP_SET_MODE_FILTER_LISTENER arguments: [ // op: const = 0x1 (8 bytes) // flags: seccomp_flags_listener = 0x0 (8 bytes) // arg: ptr[in, sock_fprog] { // sock_fprog { // len: len = 0x1 (2 bytes) // pad = 0x0 (6 bytes) // filter: ptr[in, array[sock_filter]] { // array[sock_filter] { // sock_filter { // code: int16 = 0x6 (2 bytes) // jt: int8 = 0x0 (1 bytes) // jf: int8 = 0x0 (1 bytes) // k: int32 = 0x7fff8000 (4 bytes) // } // } // } // } // } // ] // returns fd_seccomp *(uint16_t*)0x200000000040 = 1; *(uint64_t*)0x200000000048 = 0x200000000000; *(uint16_t*)0x200000000000 = 6; *(uint8_t*)0x200000000002 = 0; *(uint8_t*)0x200000000003 = 0; *(uint32_t*)0x200000000004 = 0x7fff8000; res = syscall(__NR_seccomp, /*op=*/1ul, /*flags=*/0ul, /*arg=*/0x200000000040ul); if (res != -1) r[1] = res; // close_range arguments: [ // fd: fd (resource) // max_fd: fd (resource) // flags: close_range_flags = 0x0 (8 bytes) // ] syscall(__NR_close_range, /*fd=*/r[1], /*max_fd=*/(intptr_t)-1, /*flags=*/0ul); // openat$ptp0 arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 70 74 70 30 00} (length 0xa) // } // flags: open_flags = 0x40081 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_ptp memcpy((void*)0x200000000040, "/dev/ptp0\000", 10); syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000040ul, /*flags=O_NOATIME|O_EXCL|O_WRONLY*/ 0x40081, /*mode=*/0); // clock_settime arguments: [ // id: clock_id = 0xfffffffb (8 bytes) // tp: ptr[in, timespec] { // timespec { // sec: time_sec (resource) // nsec: time_nsec (resource) // } // } // ] *(uint64_t*)0x200000000140 = 0; *(uint64_t*)0x200000000148 = 0; syscall(__NR_clock_settime, /*id=CLOCK_THREAD_CPUTIME_ID|0xfffffff8*/ 0xfffffffbul, /*tp=*/0x200000000140ul); return 0; }