// https://syzkaller.appspot.com/bug?id=b5b227304ba1971027df3d04ed774161a6402a08 // 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_sendmsg #define __NR_sendmsg 211 #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[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/7ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul); intptr_t res = 0; res = syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0x10); if (res != -1) r[0] = res; *(uint64_t*)0x20000100 = 0; *(uint32_t*)0x20000108 = 0; *(uint64_t*)0x20000110 = 0x200001c0; *(uint64_t*)0x200001c0 = 0x20000040; *(uint32_t*)0x20000040 = 0x1c; *(uint16_t*)0x20000044 = 0x3e; *(uint16_t*)0x20000046 = 1; *(uint32_t*)0x20000048 = 0; *(uint32_t*)0x2000004c = 0; *(uint8_t*)0x20000050 = 3; *(uint8_t*)0x20000051 = 0; *(uint16_t*)0x20000052 = 0; *(uint16_t*)0x20000054 = 8; STORE_BY_BITMASK(uint16_t, , 0x20000056, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000057, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000057, 0, 7, 1); *(uint32_t*)0x20000058 = 0; *(uint64_t*)0x200001c8 = 0x1c; *(uint64_t*)0x20000118 = 1; *(uint64_t*)0x20000120 = 0; *(uint64_t*)0x20000128 = 0; *(uint32_t*)0x20000130 = 0; syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x20000100ul, /*f=*/0ul); return 0; }