// https://syzkaller.appspot.com/bug?id=b5d5699104873aa56af2793af60be57fe001c5e0 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #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)))) #ifndef __NR_mmap #define __NR_mmap 192 #endif #ifndef __NR_sendmsg #define __NR_sendmsg 370 #endif #ifndef __NR_socket #define __NR_socket 359 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); intptr_t res = 0; res = syscall(__NR_socket, 0x10, 3, 0xc); if (res != -1) r[0] = res; *(uint32_t*)0x20000300 = 0; *(uint32_t*)0x20000304 = 0; *(uint32_t*)0x20000308 = 0x200002c0; *(uint32_t*)0x200002c0 = 0x20000080; *(uint32_t*)0x20000080 = 0x68; *(uint8_t*)0x20000084 = 2; *(uint8_t*)0x20000085 = 6; *(uint16_t*)0x20000086 = 1; *(uint32_t*)0x20000088 = 0; *(uint32_t*)0x2000008c = 0; *(uint8_t*)0x20000090 = 0; *(uint8_t*)0x20000091 = 0; *(uint16_t*)0x20000092 = htobe16(0); *(uint16_t*)0x20000094 = 0x12; *(uint16_t*)0x20000096 = 3; memcpy((void*)0x20000098, "bitmap:ip,mac\000", 14); *(uint16_t*)0x200000a8 = 9; *(uint16_t*)0x200000aa = 2; memcpy((void*)0x200000ac, "syz0\000", 5); *(uint16_t*)0x200000b4 = 0x1c; STORE_BY_BITMASK(uint16_t, , 0x200000b6, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000b7, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000b7, 1, 7, 1); *(uint16_t*)0x200000b8 = 0xc; STORE_BY_BITMASK(uint16_t, , 0x200000ba, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000bb, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000bb, 1, 7, 1); *(uint16_t*)0x200000bc = 8; STORE_BY_BITMASK(uint16_t, , 0x200000be, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000bf, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000bf, 0, 7, 1); *(uint32_t*)0x200000c0 = htobe32(0); *(uint16_t*)0x200000c4 = 0xc; STORE_BY_BITMASK(uint16_t, , 0x200000c6, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000c7, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000c7, 1, 7, 1); *(uint16_t*)0x200000c8 = 8; STORE_BY_BITMASK(uint16_t, , 0x200000ca, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000cb, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000cb, 0, 7, 1); *(uint32_t*)0x200000cc = htobe32(0); *(uint16_t*)0x200000d0 = 5; *(uint16_t*)0x200000d2 = 1; *(uint8_t*)0x200000d4 = 7; *(uint16_t*)0x200000d8 = 5; *(uint16_t*)0x200000da = 4; *(uint8_t*)0x200000dc = 0; *(uint16_t*)0x200000e0 = 5; *(uint16_t*)0x200000e2 = 5; *(uint8_t*)0x200000e4 = 2; *(uint32_t*)0x200002c4 = 0x68; *(uint32_t*)0x2000030c = 1; *(uint32_t*)0x20000310 = 0; *(uint32_t*)0x20000314 = 0; *(uint32_t*)0x20000318 = 0; syscall(__NR_sendmsg, (intptr_t)r[0], 0x20000300, 0); res = syscall(__NR_socket, 0x10, 3, 0xc); if (res != -1) r[1] = res; *(uint32_t*)0x20000380 = 0; *(uint32_t*)0x20000384 = 0; *(uint32_t*)0x20000388 = 0x20000340; *(uint32_t*)0x20000340 = 0x20000300; *(uint32_t*)0x20000300 = 0x1c; *(uint8_t*)0x20000304 = 7; *(uint8_t*)0x20000305 = 6; *(uint16_t*)0x20000306 = 5; *(uint32_t*)0x20000308 = 0; *(uint32_t*)0x2000030c = 0; *(uint8_t*)0x20000310 = 0; *(uint8_t*)0x20000311 = 0; *(uint16_t*)0x20000312 = htobe16(0); *(uint16_t*)0x20000314 = 5; *(uint16_t*)0x20000316 = 1; *(uint8_t*)0x20000318 = 7; *(uint32_t*)0x20000344 = 0x1c; *(uint32_t*)0x2000038c = 1; *(uint32_t*)0x20000390 = 0; *(uint32_t*)0x20000394 = 0; *(uint32_t*)0x20000398 = 0; syscall(__NR_sendmsg, (intptr_t)r[1], 0x20000380, 0); return 0; }