// https://syzkaller.appspot.com/bug?id=157b9613a410da014866c2865af1be18db03d922 // 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*)0x20000000 = 0; *(uint32_t*)0x20000004 = 0; *(uint32_t*)0x20000008 = 0x20000080; *(uint32_t*)0x20000080 = 0x20000f80; *(uint32_t*)0x20000f80 = 0x58; *(uint8_t*)0x20000f84 = 2; *(uint8_t*)0x20000f85 = 6; *(uint16_t*)0x20000f86 = 1; *(uint32_t*)0x20000f88 = 0; *(uint32_t*)0x20000f8c = 0; *(uint8_t*)0x20000f90 = 0; *(uint8_t*)0x20000f91 = 0; *(uint16_t*)0x20000f92 = htobe16(0); *(uint16_t*)0x20000f94 = 0x12; *(uint16_t*)0x20000f96 = 3; memcpy((void*)0x20000f98, "hash:net,port\000", 14); *(uint16_t*)0x20000fa8 = 5; *(uint16_t*)0x20000faa = 4; *(uint8_t*)0x20000fac = 0; *(uint16_t*)0x20000fb0 = 9; *(uint16_t*)0x20000fb2 = 2; memcpy((void*)0x20000fb4, "syz0\000", 5); *(uint16_t*)0x20000fbc = 0xc; STORE_BY_BITMASK(uint16_t, , 0x20000fbe, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000fbf, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000fbf, 1, 7, 1); *(uint16_t*)0x20000fc0 = 8; STORE_BY_BITMASK(uint16_t, , 0x20000fc2, 6, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000fc3, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000fc3, 0, 7, 1); *(uint32_t*)0x20000fc4 = htobe32(0); *(uint16_t*)0x20000fc8 = 5; *(uint16_t*)0x20000fca = 5; *(uint8_t*)0x20000fcc = 2; *(uint16_t*)0x20000fd0 = 5; *(uint16_t*)0x20000fd2 = 1; *(uint8_t*)0x20000fd4 = 7; *(uint32_t*)0x20000084 = 0x58; *(uint32_t*)0x2000000c = 1; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = 0; *(uint32_t*)0x20000018 = 0; syscall(__NR_sendmsg, (intptr_t)r[0], 0x20000000, 0); res = syscall(__NR_socket, 0x10, 3, 0xc); if (res != -1) r[1] = res; *(uint32_t*)0x20000180 = 0; *(uint32_t*)0x20000184 = 0; *(uint32_t*)0x20000188 = 0x20000140; *(uint32_t*)0x20000140 = 0x20000080; *(uint32_t*)0x20000080 = 0x4c; *(uint8_t*)0x20000084 = 0xb; *(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 = 5; *(uint16_t*)0x20000096 = 1; *(uint8_t*)0x20000098 = 7; *(uint16_t*)0x2000009c = 9; *(uint16_t*)0x2000009e = 2; memcpy((void*)0x200000a0, "syz0\000", 5); *(uint16_t*)0x200000a8 = 0x24; STORE_BY_BITMASK(uint16_t, , 0x200000aa, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000ab, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000ab, 1, 7, 1); *(uint16_t*)0x200000ac = 8; STORE_BY_BITMASK(uint16_t, , 0x200000ae, 9, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000af, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000af, 0, 7, 1); *(uint32_t*)0x200000b0 = htobe32(4); *(uint16_t*)0x200000b4 = 9; *(uint16_t*)0x200000b6 = 0x1a; memcpy((void*)0x200000b8, "syz0\000", 5); *(uint16_t*)0x200000c0 = 0xc; STORE_BY_BITMASK(uint16_t, , 0x200000c2, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000c3, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000c3, 1, 7, 1); *(uint16_t*)0x200000c4 = 8; STORE_BY_BITMASK(uint16_t, , 0x200000c6, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200000c7, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200000c7, 0, 7, 1); *(uint8_t*)0x200000c8 = 0xac; *(uint8_t*)0x200000c9 = 0x14; *(uint8_t*)0x200000ca = 0x14; *(uint8_t*)0x200000cb = 0x16; *(uint32_t*)0x20000144 = 0x4c; *(uint32_t*)0x2000018c = 1; *(uint32_t*)0x20000190 = 0; *(uint32_t*)0x20000194 = 0; *(uint32_t*)0x20000198 = 0; syscall(__NR_sendmsg, (intptr_t)r[1], 0x20000180, 0); return 0; }