// https://syzkaller.appspot.com/bug?id=8220a8f376ad410bb013c26c6b28f8c03bebb936 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_write #define __NR_write 64 #endif uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*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=*/0x21000000ul, /*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)) { } // openat$cgroup_ro arguments: [ // fd: fd_cgroup (resource) // file: ptr[in, buffer] { // buffer: {6d 65 6d 6f 72 79 2e 73 77 61 70 2e 63 75 72 72 65 6e 74 00} // (length 0x14) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x20000540, "memory.swap.current\000", 20); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000540ul, /*flags=*/0x275a, /*mode=*/0); if (res != -1) r[0] = res; // write$binfmt_script arguments: [ // fd: fd_binfmt (resource) // data: ptr[in, binfmt_script] { // binfmt_script { // hdr: buffer: {23 21 20} (length 0x3) // bin: buffer: {} (length 0x0) // args: array[binfmt_script_arg] { // } // nl: const = 0xa (1 bytes) // data: buffer: {} (length 0x0) // } // } // len: bytesize = 0x208e24b (8 bytes) // ] memcpy((void*)0x20000000, "#! ", 3); *(uint8_t*)0x20000003 = 0xa; syscall(__NR_write, /*fd=*/r[0], /*data=*/0x20000000ul, /*len=*/0x208e24bul); return 0; }