// https://syzkaller.appspot.com/bug?id=515386f27225b0b9d8cd93736b3f4645051433f9 // 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 321 #endif #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*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=*/0x200001000000ul, /*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)) { } *(uint32_t*)0x200000000600 = 0x20; *(uint32_t*)0x200000000604 = 3; *(uint64_t*)0x200000000608 = 0x200000000200; *(uint8_t*)0x200000000200 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000201, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000201, 0, 4, 4); *(uint16_t*)0x200000000202 = 0; *(uint32_t*)0x200000000204 = 0; *(uint8_t*)0x200000000208 = 0; *(uint8_t*)0x200000000209 = 0; *(uint16_t*)0x20000000020a = 0; *(uint32_t*)0x20000000020c = 0; *(uint8_t*)0x200000000210 = 0x95; *(uint8_t*)0x200000000211 = 0; *(uint16_t*)0x200000000212 = 0; *(uint32_t*)0x200000000214 = 0; *(uint64_t*)0x200000000610 = 0x200000000000; memcpy((void*)0x200000000000, "syzkaller\000", 10); *(uint32_t*)0x200000000618 = 5; *(uint32_t*)0x20000000061c = 0; *(uint64_t*)0x200000000620 = 0; *(uint32_t*)0x200000000628 = 0; *(uint32_t*)0x20000000062c = 0; memset((void*)0x200000000630, 0, 16); *(uint32_t*)0x200000000640 = 0; *(uint32_t*)0x200000000644 = 0x2d; *(uint32_t*)0x200000000648 = -1; *(uint32_t*)0x20000000064c = 0; *(uint64_t*)0x200000000650 = 0; *(uint32_t*)0x200000000658 = 0; *(uint32_t*)0x20000000065c = 0; *(uint64_t*)0x200000000660 = 0; *(uint32_t*)0x200000000668 = 0; *(uint32_t*)0x20000000066c = 0; *(uint32_t*)0x200000000670 = 0; *(uint32_t*)0x200000000674 = 0; *(uint64_t*)0x200000000678 = 0; *(uint64_t*)0x200000000680 = 0; *(uint32_t*)0x200000000688 = 0; *(uint32_t*)0x20000000068c = 0x99ee; *(uint32_t*)0x200000000690 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000600ul, /*size=*/0x94ul); if (res != -1) r[0] = res; *(uint32_t*)0x200000002380 = r[0]; *(uint32_t*)0x200000002384 = 0; *(uint32_t*)0x200000002388 = 0x2d; *(uint32_t*)0x20000000238c = 0; *(uint32_t*)0x200000002390 = 2; *(uint32_t*)0x200000002394 = 4; *(uint32_t*)0x200000002398 = 0x600; *(uint32_t*)0x20000000239c = 1; syscall(__NR_bpf, /*cmd=*/0x1cul, /*arg=*/0x200000002380ul, /*size=*/0x20ul); res = syscall(__NR_socket, /*domain=AF_INET*/ 2ul, /*type=SOCK_STREAM*/ 1ul, /*proto=*/0); if (res != -1) r[1] = res; *(uint16_t*)0x200000000080 = 2; *(uint16_t*)0x200000000082 = htobe16(0x4e20); *(uint8_t*)0x200000000084 = 0xac; *(uint8_t*)0x200000000085 = 0x14; *(uint8_t*)0x200000000086 = 0x14; *(uint8_t*)0x200000000087 = 0x28; syscall(__NR_sendto, /*fd=*/r[1], /*buf=*/0ul, /*len=*/0ul, /*f=MSG_FASTOPEN|MSG_BATCH|MSG_MORE|MSG_DONTWAIT*/ 0x20048040ul, /*addr=*/0x200000000080ul, /*addrlen=*/0x10ul); return 0; }