// https://syzkaller.appspot.com/bug?id=5388824c1e18a045263859c865be0409bc5459bf // 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 = 0x20000040; *(uint64_t*)0x20000040 = 0x200001c0; *(uint32_t*)0x200001c0 = 0x188; *(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 = 0x158; *(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; *(uint16_t*)0x2000020e = 2; *(uint16_t*)0x20000210 = 0xc; *(uint16_t*)0x20000212 = 0xb; *(uint64_t*)0x20000214 = 0; *(uint16_t*)0x2000021c = 0xc4; STORE_BY_BITMASK(uint16_t, , 0x2000021e, 5, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000021f, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000021f, 1, 7, 1); *(uint16_t*)0x20000220 = 0x14; *(uint16_t*)0x20000222 = 2; *(uint32_t*)0x20000224 = 0; *(uint32_t*)0x20000228 = 0; *(uint32_t*)0x2000022c = 0; *(uint32_t*)0x20000230 = 0; *(uint16_t*)0x20000234 = 0x14; *(uint16_t*)0x20000236 = 2; *(uint32_t*)0x20000238 = 0; *(uint32_t*)0x2000023c = 0; *(uint32_t*)0x20000240 = 0; *(uint32_t*)0x20000244 = 0; *(uint16_t*)0x20000248 = 0x18; *(uint16_t*)0x2000024a = 1; *(uint32_t*)0x2000024c = 0; *(uint32_t*)0x20000250 = 0; *(uint32_t*)0x20000254 = 0; *(uint32_t*)0x20000258 = 0; *(uint32_t*)0x2000025c = 0; *(uint16_t*)0x20000260 = 0x14; *(uint16_t*)0x20000262 = 2; *(uint32_t*)0x20000264 = 0; *(uint32_t*)0x20000268 = 0; *(uint32_t*)0x2000026c = 0; *(uint32_t*)0x20000270 = 0; *(uint16_t*)0x20000274 = 0x18; *(uint16_t*)0x20000276 = 1; *(uint32_t*)0x20000278 = 0; *(uint32_t*)0x2000027c = 0; *(uint32_t*)0x20000280 = 0; *(uint32_t*)0x20000284 = 0; *(uint32_t*)0x20000288 = 0; *(uint16_t*)0x2000028c = 0x14; *(uint16_t*)0x2000028e = 2; *(uint32_t*)0x20000290 = 0; *(uint32_t*)0x20000294 = 0; *(uint32_t*)0x20000298 = 0; *(uint32_t*)0x2000029c = 0; *(uint16_t*)0x200002a0 = 0xffa7; *(uint16_t*)0x200002a2 = 2; *(uint32_t*)0x200002a4 = 0; *(uint32_t*)0x200002a8 = 0; *(uint32_t*)0x200002ac = 0; *(uint32_t*)0x200002b0 = 0; *(uint16_t*)0x200002b4 = 0x14; *(uint16_t*)0x200002b6 = 2; *(uint32_t*)0x200002b8 = 0; *(uint32_t*)0x200002bc = 0; *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 0; *(uint16_t*)0x200002c8 = 0x18; *(uint16_t*)0x200002ca = 1; *(uint32_t*)0x200002cc = 0; *(uint32_t*)0x200002d0 = 0; *(uint32_t*)0x200002d4 = 0; *(uint32_t*)0x200002d8 = 0; *(uint32_t*)0x200002dc = 0; *(uint16_t*)0x200002e0 = 0x66; *(uint16_t*)0x200002e2 = 2; memcpy((void*)0x200002e4, "\x09\x5d\x9a\xa3\x1d\x0b\xd8\xa0\xb8\xf7\xbc\xa9\x67\x38\xae\xe1\x94" "\x86\x23\x70\x0e\x37\xb9\x79\xd5\x7e\xd0\x2c\x94\x4a\xf3\x29\x0c\x81" "\x27\x8b\x85\xbe\xed\x8c\x93\x54\xdb\x81\xef\xc7\xa9\xd4\x04\x0c\x70" "\xe7\x4b\x1f\x69\x83\xbd\xec\xc0\x34\x5c\xc3\x80\xdc\x56\xbc\x41\xb4" "\xe2\xc7\x42\x88\x01\x59\x36\x47\x28\xe7\x67\x06\x54\x1b\xc2\xc5\xb9" "\xd2\x82\x7a\x61\x97\xb5\x10\xef\xec\xd5\xfb\xc5\x76", 98); *(uint64_t*)0x20000048 = 0x188; *(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; }