// 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_bind #define __NR_bind 200 #endif #ifndef __NR_getsockname #define __NR_getsockname 204 #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 #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_socket, /*domain=*/0x11ul, /*type=*/0x800000003ul, /*proto=*/0); if (res != -1) r[1] = res; *(uint16_t*)0x20000080 = 0x11; memcpy((void*)0x20000082, "\x00\x00\x01\x00\x00\x00\x00\x00\x08\x00\x44\x94\x4e\xeb\xa7\x1a\x49" "\x76\xe2\x52\x92\x2c\xb1\x8f\x6e\x2e\x2a\xba\x00\x00\x00\x01\x2e\x0b" "\x38\x36\x00\x54\x04\xb0\xe0\x30\x1a\x4c\xe8\x75\xf2\xe3\xff\x5f\x16" "\x3e\xe3\x40\xb7\x67\x95\x00\x80\x00\x00\x00\x00\x00\x00\x01\x01\x01" "\x3c\x58\x11\x03\x9e\x15\x77\x50\x27\xec\xce\x66\xfd\x79\x2b\xbf\x0e" "\x5b\xf5\xff\x1b\x08\x16\xf3\xf6\xdb\x1c\x00\x01\x00\x00\x00\x00\x00" "\x00\x00\x49\x74\x00\x00\x00\x00\x00\x00\x00\x06\xad\x8e\x5e\xcc\x32" "\x6d\x3a\x09\xff\xc2\xc6\x54", 126); syscall(__NR_bind, /*fd=*/r[1], /*addr=*/0x20000080ul, /*addrlen=*/0x80ul); *(uint32_t*)0x20000000 = 0x14; res = syscall(__NR_getsockname, /*fd=*/r[1], /*addr=*/0x20005400ul, /*addrlen=*/0x20000000ul); if (res != -1) r[2] = *(uint32_t*)0x20005404; *(uint64_t*)0x20000180 = 0; *(uint32_t*)0x20000188 = 0; *(uint64_t*)0x20000190 = 0x20000680; *(uint64_t*)0x20000680 = 0x200001c0; *(uint32_t*)0x200001c0 = 0x94; *(uint16_t*)0x200001c4 = 0x24; *(uint16_t*)0x200001c6 = 0xf0b; *(uint32_t*)0x200001c8 = 0; *(uint32_t*)0x200001cc = 0; *(uint8_t*)0x200001d0 = 0; *(uint8_t*)0x200001d1 = 0; *(uint16_t*)0x200001d2 = 0; *(uint32_t*)0x200001d4 = r[2]; *(uint16_t*)0x200001d8 = 0; *(uint16_t*)0x200001da = 0; *(uint16_t*)0x200001dc = -1; *(uint16_t*)0x200001de = -1; *(uint16_t*)0x200001e0 = 0; *(uint16_t*)0x200001e2 = 0; *(uint16_t*)0x200001e4 = 0xa; *(uint16_t*)0x200001e6 = 1; memcpy((void*)0x200001e8, "netem\000", 6); *(uint16_t*)0x200001f0 = 0x64; *(uint16_t*)0x200001f2 = 2; *(uint32_t*)0x200001f4 = 0; *(uint32_t*)0x200001f8 = 0; *(uint32_t*)0x200001fc = 0; *(uint32_t*)0x20000200 = 0; *(uint32_t*)0x20000204 = 0; *(uint32_t*)0x20000208 = 0; *(uint16_t*)0x2000020c = 4; STORE_BY_BITMASK(uint16_t, , 0x2000020e, 5, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000020f, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000020f, 1, 7, 1); *(uint16_t*)0x20000210 = 0x18; *(uint16_t*)0x20000212 = 0xd; *(uint32_t*)0x20000214 = 0; *(uint32_t*)0x20000218 = 0; *(uint32_t*)0x2000021c = 0; *(uint32_t*)0x20000220 = 0; *(uint32_t*)0x20000224 = 0; *(uint16_t*)0x20000228 = 0x18; *(uint16_t*)0x2000022a = 1; *(uint32_t*)0x2000022c = 0; *(uint32_t*)0x20000230 = 0; *(uint32_t*)0x20000234 = 0; *(uint32_t*)0x20000238 = 0; *(uint32_t*)0x2000023c = 0; *(uint16_t*)0x20000240 = 0x14; *(uint16_t*)0x20000242 = 2; *(uint32_t*)0x20000244 = 0; *(uint32_t*)0x20000248 = 0; *(uint32_t*)0x2000024c = 0; *(uint32_t*)0x20000250 = 0; *(uint64_t*)0x20000688 = 0x94; *(uint64_t*)0x20000198 = 1; *(uint64_t*)0x200001a0 = 0; *(uint64_t*)0x200001a8 = 0; *(uint32_t*)0x200001b0 = 0; syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x20000180ul, /*f=*/0ul); return 0; }