// 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 280 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_sendto #define __NR_sendto 206 #endif #ifndef __NR_socket #define __NR_socket 198 #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=*/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)) { } *(uint32_t*)0x20000600 = 0x20; *(uint32_t*)0x20000604 = 3; *(uint64_t*)0x20000608 = 0x20000200; *(uint8_t*)0x20000200 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x20000201, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20000201, 0, 4, 4); *(uint16_t*)0x20000202 = 0; *(uint32_t*)0x20000204 = 0; *(uint8_t*)0x20000208 = 0; *(uint8_t*)0x20000209 = 0; *(uint16_t*)0x2000020a = 0; *(uint32_t*)0x2000020c = 0; *(uint8_t*)0x20000210 = 0x95; *(uint8_t*)0x20000211 = 0; *(uint16_t*)0x20000212 = 0; *(uint32_t*)0x20000214 = 0; *(uint64_t*)0x20000610 = 0x20000000; memcpy((void*)0x20000000, "syzkaller\000", 10); *(uint32_t*)0x20000618 = 0; *(uint32_t*)0x2000061c = 0; *(uint64_t*)0x20000620 = 0; *(uint32_t*)0x20000628 = 0; *(uint32_t*)0x2000062c = 0; memset((void*)0x20000630, 0, 16); *(uint32_t*)0x20000640 = 0; *(uint32_t*)0x20000644 = 0x2d; *(uint32_t*)0x20000648 = -1; *(uint32_t*)0x2000064c = 0; *(uint64_t*)0x20000650 = 0; *(uint32_t*)0x20000658 = 0; *(uint32_t*)0x2000065c = 0; *(uint64_t*)0x20000660 = 0; *(uint32_t*)0x20000668 = 0; *(uint32_t*)0x2000066c = 0; *(uint32_t*)0x20000670 = 0; *(uint32_t*)0x20000674 = 0; *(uint64_t*)0x20000678 = 0; *(uint64_t*)0x20000680 = 0; *(uint32_t*)0x20000688 = 0; *(uint32_t*)0x2000068c = 0x99ee; *(uint32_t*)0x20000690 = 0; res = syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x20000600ul, /*size=*/0x94ul); if (res != -1) r[0] = res; *(uint32_t*)0x20002380 = r[0]; *(uint32_t*)0x20002384 = 0; *(uint32_t*)0x20002388 = 0x2d; *(uint32_t*)0x2000238c = 0; *(uint32_t*)0x20002390 = 2; *(uint32_t*)0x20002394 = 4; *(uint32_t*)0x20002398 = 0x600; *(uint32_t*)0x2000239c = 1; syscall(__NR_bpf, /*cmd=*/0x1cul, /*arg=*/0x20002380ul, /*size=*/0x20ul); res = syscall(__NR_socket, /*domain=*/2ul, /*type=*/2ul, /*proto=*/0); if (res != -1) r[1] = res; *(uint16_t*)0x20000000 = 2; *(uint16_t*)0x20000002 = htobe16(0x4e20); *(uint32_t*)0x20000004 = htobe32(0); syscall(__NR_sendto, /*fd=*/r[1], /*buf=*/0ul, /*len=*/0ul, /*f=*/0ul, /*addr=*/0x20000000ul, /*addrlen=*/0x10ul); return 0; }