// https://syzkaller.appspot.com/bug?id=acbdbce572deeb65f3e0e5b7705bdb8d16b1210f // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #ifndef __NR_ioctl #define __NR_ioctl 29 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_sendmsg #define __NR_sendmsg 211 #endif #ifndef __NR_socket #define __NR_socket 198 #endif #ifndef __NR_socketpair #define __NR_socketpair 199 #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[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0}; 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=*/0); if (res != -1) r[0] = res; res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=*/1ul, /*proto=*/0, /*fds=*/0x20000080ul); if (res != -1) r[1] = *(uint32_t*)0x20000084; memcpy((void*)0x20000000, "lo\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 16); res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x8933, /*arg=*/0x20000000ul); if (res != -1) r[2] = *(uint32_t*)0x20000010; *(uint64_t*)0x20000040 = 0; *(uint32_t*)0x20000048 = 0; *(uint64_t*)0x20000050 = 0x20000780; *(uint64_t*)0x20000780 = 0x20000f80; *(uint32_t*)0x20000f80 = 0xb0; *(uint16_t*)0x20000f84 = 0x24; *(uint16_t*)0x20000f86 = 0xf0b; *(uint32_t*)0x20000f88 = 0; *(uint32_t*)0x20000f8c = 1; *(uint8_t*)0x20000f90 = 0x60; *(uint8_t*)0x20000f91 = 0; *(uint16_t*)0x20000f92 = 0; *(uint32_t*)0x20000f94 = r[2]; *(uint16_t*)0x20000f98 = 0; *(uint16_t*)0x20000f9a = 0; *(uint16_t*)0x20000f9c = -1; *(uint16_t*)0x20000f9e = -1; *(uint16_t*)0x20000fa0 = 5; *(uint16_t*)0x20000fa2 = 0xffe0; *(uint16_t*)0x20000fa4 = 0xa; *(uint16_t*)0x20000fa6 = 1; memcpy((void*)0x20000fa8, "netem\000", 6); *(uint16_t*)0x20000fb0 = 0x80; *(uint16_t*)0x20000fb2 = 2; *(uint32_t*)0x20000fb4 = 0; *(uint32_t*)0x20000fb8 = 0; *(uint32_t*)0x20000fbc = 0; *(uint32_t*)0x20000fc0 = 0; *(uint32_t*)0x20000fc4 = 0; *(uint32_t*)0x20000fc8 = 0; *(uint16_t*)0x20000fcc = 4; STORE_BY_BITMASK(uint16_t, , 0x20000fce, 5, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000fcf, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000fcf, 1, 7, 1); *(uint16_t*)0x20000fd0 = 0x5d; *(uint16_t*)0x20000fd2 = 2; memcpy( (void*)0x20000fd4, "\x74\x5c\xdc\xc8\x29\x75\x64\x2b\x95\x8e\x28\x96\x65\x0e\x56\x90\x7d\x41" "\xa8\x11\x88\xd6\xed\x4f\x57\x53\x5d\x0a\xd5\x19\x28\x33\x12\xac\x5b\x8e" "\x27\x2c\x5a\x50\x43\x73\x5a\x50\xc8\xff\x28\xec\x7f\xb2\x94\x98\xde\x22" "\xdd\x4f\xc7\x33\x7c\x0b\x3f\x74\x1c\xf2\xab\xa6\x28\xed\x2f\x66\x77\x19" "\x48\x5e\xed\x0b\x3c\xe7\x59\x85\x03\xeb\x2b\xfb\x6f\xaa\xa9\x57\x1c", 89); *(uint64_t*)0x20000788 = 0xb0; *(uint64_t*)0x20000058 = 1; *(uint64_t*)0x20000060 = 0; *(uint64_t*)0x20000068 = 0; *(uint32_t*)0x20000070 = 0; syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x20000040ul, /*f=*/0x4004840ul); return 0; }