// 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_bpf #define __NR_bpf 280 #endif #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 65 76 65 6e 74 73 00} (length 0xe) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x200001c0, "memory.events\000", 14); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200001c0ul, /*flags=*/0x275a, /*mode=*/0); if (res != -1) r[0] = res; // bpf$MAP_CREATE arguments: [ // cmd: const = 0x0 (8 bytes) // arg: ptr[in, bpf_map_create_arg] { // union bpf_map_create_arg { // base: bpf_map_create_arg_t[flags[bpf_map_type, int32], int32, int32, // int32, flags[map_flags, int32], const[0, int64]] { // type: bpf_map_type = 0x9 (4 bytes) // ksize: int32 = 0x4 (4 bytes) // vsize: int32 = 0x6 (4 bytes) // max: int32 = 0xff (4 bytes) // flags: map_flags = 0x42 (4 bytes) // inner: fd_bpf_map (resource) // node: int32 = 0x0 (4 bytes) // map_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00} (length 0x10) map_ifindex: ifindex (resource) btf_fd: fd_btf // (resource) btf_key_type_id: int32 = 0x0 (4 bytes) // btf_value_type_id: int32 = 0x0 (4 bytes) // btf_vmlinux_type_id: int32 = 0x0 (4 bytes) // map_extra: const = 0x0 (8 bytes) // value_type_btf_obj_fd: union // _bpf_map_create_arg_t[flags[bpf_map_type, int32], int32, int32, // int32, flags[map_flags, int32], const[0, // int64]]_value_type_btf_obj_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad1: union _bpf_map_create_arg_t[flags[bpf_map_type, int32], // int32, int32, int32, flags[map_flags, int32], const[0, // int64]]_pad1_wrapper { // value: const = 0x0 (4 bytes) // } // map_token_fd: union _bpf_map_create_arg_t[flags[bpf_map_type, // int32], int32, int32, int32, flags[map_flags, int32], const[0, // int64]]_map_token_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad2: union _bpf_map_create_arg_t[flags[bpf_map_type, int32], // int32, int32, int32, flags[map_flags, int32], const[0, // int64]]_pad2_wrapper { // value: const = 0x0 (4 bytes) // } // } // } // } // size: len = 0x48 (8 bytes) // ] // returns fd_bpf_map *(uint32_t*)0x20000000 = 9; *(uint32_t*)0x20000004 = 4; *(uint32_t*)0x20000008 = 6; *(uint32_t*)0x2000000c = 0xff; *(uint32_t*)0x20000010 = 0x42; *(uint32_t*)0x20000014 = -1; *(uint32_t*)0x20000018 = 0; memset((void*)0x2000001c, 0, 16); *(uint32_t*)0x2000002c = 0; *(uint32_t*)0x20000030 = -1; *(uint32_t*)0x20000034 = 0; *(uint32_t*)0x20000038 = 0; *(uint32_t*)0x2000003c = 0; *(uint64_t*)0x20000040 = 0; *(uint32_t*)0x20000048 = 0; *(uint32_t*)0x2000004c = 0; syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x20000000ul, /*size=*/0x48ul); // bpf$MAP_UPDATE_BATCH arguments: [ // cmd: const = 0x1a (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/0x1aul, /*arg=*/0ul, /*size=*/0ul); // write$cgroup_subtree arguments: [ // fd: fd_cgroup_subtree (resource) // buf: nil // len: bytesize = 0x32600 (8 bytes) // ] syscall(__NR_write, /*fd=*/r[0], /*buf=*/0ul, /*len=*/0x32600ul); // mmap arguments: [ // addr: VMA[0x3000] // len: len = 0x3000 (8 bytes) // prot: mmap_prot = 0x2000005 (8 bytes) // flags: mmap_flags = 0x12 (8 bytes) // fd: fd (resource) // offset: intptr = 0x0 (8 bytes) // ] syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x3000ul, /*prot=PROT_GROWSUP|PROT_READ|PROT_EXEC*/ 0x2000005ul, /*flags=MAP_FIXED|MAP_PRIVATE*/ 0x12ul, /*fd=*/r[0], /*offset=*/0ul); // bpf$MAP_UPDATE_BATCH arguments: [ // cmd: const = 0x1a (8 bytes) // arg: nil // size: len = 0x0 (8 bytes) // ] syscall(__NR_bpf, /*cmd=*/0x1aul, /*arg=*/0ul, /*size=*/0ul); return 0; }