// https://syzkaller.appspot.com/bug?id=71cdc297694ed30e78cbdf14f470b368bcf465a2 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #ifndef __NR_clock_adjtime #define __NR_clock_adjtime 266 #endif #ifndef __NR_mkdirat #define __NR_mkdirat 34 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_mount #define __NR_mount 40 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_socketpair #define __NR_socketpair 199 #endif #ifndef __NR_write #define __NR_write 64 #endif uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*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)) { } // socketpair$unix arguments: [ // domain: const = 0x1 (8 bytes) // type: unix_socket_type = 0x2 (8 bytes) // proto: const = 0x0 (4 bytes) // fds: ptr[out, unix_pair] { // unix_pair { // fd0: sock_unix (resource) // fd1: sock_unix (resource) // } // } // ] syscall(__NR_socketpair, /*domain=*/1ul, /*type=SOCK_DGRAM*/ 2ul, /*proto=*/0, /*fds=*/0x20000100ul); // 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 = 0x2401 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_ptp memcpy((void*)0x20000140, "/dev/ptp0\000", 10); syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000140ul, /*flags=FASYNC|O_APPEND|O_WRONLY*/ 0x2401, /*mode=*/0); // clock_adjtime arguments: [ // id: clock_id = 0xffffffd3 (8 bytes) // tx: ptr[in, timex] { // timex { // stuff0: intptr = 0xfffc (8 bytes) // stuff1: intptr = 0x6 (8 bytes) // stuff2: intptr = 0xffffffffffffffff (8 bytes) // stuff3: intptr = 0x8000000000000000 (8 bytes) // stuff4: intptr = 0x7 (8 bytes) // stuff5: intptr = 0x9 (8 bytes) // stuff6: intptr = 0x651 (8 bytes) // stuff7: intptr = 0xc (8 bytes) // stuff8: intptr = 0x8000009657 (8 bytes) // stuff9: intptr = 0xffeffffffffffffd (8 bytes) // stuff10: intptr = 0x62db (8 bytes) // stuff11: intptr = 0x9a3f (8 bytes) // stuff12: intptr = 0x10 (8 bytes) // stuff13: intptr = 0xb (8 bytes) // stuff14: intptr = 0x80000000000000 (8 bytes) // stuff15: intptr = 0xcc0 (8 bytes) // stuff16: intptr = 0x6 (8 bytes) // stuff17: intptr = 0x1 (8 bytes) // stuff18: intptr = 0x94d6 (8 bytes) // stuff19: intptr = 0x0 (8 bytes) // stuff20: intptr = 0x3 (8 bytes) // stuff21: intptr = 0xfffffffffffffffb (8 bytes) // stuff22: intptr = 0x0 (8 bytes) // stuff23: intptr = 0xffffffffffff9d06 (8 bytes) // stuff24: intptr = 0x3 (8 bytes) // stuff25: intptr = 0x9 (8 bytes) // } // } // ] *(uint64_t*)0x20000000 = 0xfffc; *(uint64_t*)0x20000008 = 6; *(uint64_t*)0x20000010 = -1; *(uint64_t*)0x20000018 = 0x8000000000000000; *(uint64_t*)0x20000020 = 7; *(uint64_t*)0x20000028 = 9; *(uint64_t*)0x20000030 = 0x651; *(uint64_t*)0x20000038 = 0xc; *(uint64_t*)0x20000040 = 0x8000009657; *(uint64_t*)0x20000048 = 0xffeffffffffffffd; *(uint64_t*)0x20000050 = 0x62db; *(uint64_t*)0x20000058 = 0x9a3f; *(uint64_t*)0x20000060 = 0x10; *(uint64_t*)0x20000068 = 0xb; *(uint64_t*)0x20000070 = 0x80000000000000; *(uint64_t*)0x20000078 = 0xcc0; *(uint64_t*)0x20000080 = 6; *(uint64_t*)0x20000088 = 1; *(uint64_t*)0x20000090 = 0x94d6; *(uint64_t*)0x20000098 = 0; *(uint64_t*)0x200000a0 = 3; *(uint64_t*)0x200000a8 = 0xfffffffffffffffb; *(uint64_t*)0x200000b0 = 0; *(uint64_t*)0x200000b8 = 0xffffffffffff9d06; *(uint64_t*)0x200000c0 = 3; *(uint64_t*)0x200000c8 = 9; syscall(__NR_clock_adjtime, /*id=CLOCK_THREAD_CPUTIME_ID|0xffffffd0*/ 0xffffffd3ul, /*tx=*/0x20000000ul); // 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*)0x20000000, "./sys\000", 6); syscall( __NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x20000000ul, /*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*)0x20000000, "./sys\000", 6); memcpy((void*)0x200000c0, "sysfs\000", 6); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x20000000ul, /*type=*/0x200000c0ul, /*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 = 0x20802 (4 bytes) // mode: open_mode = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x20000100, "./sys/class/ptp/ptp0/n_vclocks\000", 31); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000100ul, /*flags=O_NONBLOCK|O_LARGEFILE|O_RDWR*/ 0x20802, /*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*)0x20000200, 49, 1); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x20000200ul, /*count=*/1ul); // write$cgroup_pid arguments: [ // fd: fd_cgroup_pid (resource) // buf: ptr[in, pid] { // pid (resource) // } // len: bytesize = 0x12 (8 bytes) // ] sprintf((char*)0x20000180, "0x%016llx", (long long)0); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x20000180ul, /*len=*/0x12ul); return 0; }