// https://syzkaller.appspot.com/bug?id=be77af8f4170f3350bed40f1b060851541287f2f // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #define BITMASK_LEN(type, bf_len) (type)((1ull << (bf_len)) - 1) #define BITMASK_LEN_OFF(type, bf_off, bf_len) \ (type)(BITMASK_LEN(type, (bf_len)) << (bf_off)) #define STORE_BY_BITMASK(type, addr, val, bf_off, bf_len) \ if ((bf_off) == 0 && (bf_len) == 0) { \ *(type*)(addr) = (type)(val); \ } else { \ type new_val = *(type*)(addr); \ new_val &= ~BITMASK_LEN_OFF(type, (bf_off), (bf_len)); \ new_val |= ((type)(val)&BITMASK_LEN(type, (bf_len))) << (bf_off); \ *(type*)(addr) = new_val; \ } struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i; for (i = 0; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += (uint16_t)data[length - 1]; while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void loop() { long res; res = syscall(__NR_socket, 0xa, 2, 0); if (res != -1) r[0] = res; res = syscall(__NR_socket, 0x18, 1, 1); if (res != -1) r[1] = res; *(uint16_t*)0x205fafd2 = 0x18; *(uint32_t*)0x205fafd4 = 1; *(uint32_t*)0x205fafd8 = 0; *(uint32_t*)0x205fafdc = r[0]; *(uint16_t*)0x205fafe0 = 2; *(uint16_t*)0x205fafe2 = htobe16(0x4e21); *(uint32_t*)0x205fafe4 = htobe32(0xe0000002); *(uint8_t*)0x205fafe8 = 0; *(uint8_t*)0x205fafe9 = 0; *(uint8_t*)0x205fafea = 0; *(uint8_t*)0x205fafeb = 0; *(uint8_t*)0x205fafec = 0; *(uint8_t*)0x205fafed = 0; *(uint8_t*)0x205fafee = 0; *(uint8_t*)0x205fafef = 0; *(uint32_t*)0x205faff0 = 4; *(uint32_t*)0x205faff4 = 0; *(uint32_t*)0x205faff8 = 2; *(uint32_t*)0x205faffc = 0; syscall(__NR_connect, r[1], 0x205fafd2, 0x2e); *(uint16_t*)0x20000280 = 0xa; *(uint16_t*)0x20000282 = htobe16(0x4e24); *(uint32_t*)0x20000284 = 4; *(uint8_t*)0x20000288 = 0; *(uint8_t*)0x20000289 = 0; *(uint8_t*)0x2000028a = 0; *(uint8_t*)0x2000028b = 0; *(uint8_t*)0x2000028c = 0; *(uint8_t*)0x2000028d = 0; *(uint8_t*)0x2000028e = 0; *(uint8_t*)0x2000028f = 0; *(uint8_t*)0x20000290 = 0; *(uint8_t*)0x20000291 = 0; *(uint8_t*)0x20000292 = -1; *(uint8_t*)0x20000293 = -1; *(uint32_t*)0x20000294 = htobe32(0x7f000001); *(uint32_t*)0x20000298 = 4; syscall(__NR_connect, r[0], 0x20000280, 0x1c); *(uint64_t*)0x2037ffc8 = 0x209dd000; *(uint16_t*)0x209dd000 = 0x10; *(uint16_t*)0x209dd002 = 0; *(uint32_t*)0x209dd004 = 0; *(uint32_t*)0x209dd008 = 2; *(uint32_t*)0x2037ffd0 = 0xc; *(uint64_t*)0x2037ffd8 = 0x202ceff0; *(uint64_t*)0x202ceff0 = 0x20000040; *(uint32_t*)0x20000040 = 0x130; *(uint16_t*)0x20000044 = 0x13; *(uint16_t*)0x20000046 = 0x100; *(uint32_t*)0x20000048 = 0x70bd2a; *(uint32_t*)0x2000004c = 0x25dfdbfc; memcpy((void*)0x20000050, "\x74\x67\x72\x31\x32\x38\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 64); *(uint8_t*)0x20000090 = 0; *(uint8_t*)0x20000091 = 0; *(uint8_t*)0x20000092 = 0; *(uint8_t*)0x20000093 = 0; *(uint8_t*)0x20000094 = 0; *(uint8_t*)0x20000095 = 0; *(uint8_t*)0x20000096 = 0; *(uint8_t*)0x20000097 = 0; *(uint8_t*)0x20000098 = 0; *(uint8_t*)0x20000099 = 0; *(uint8_t*)0x2000009a = 0; *(uint8_t*)0x2000009b = 0; *(uint8_t*)0x2000009c = 0; *(uint8_t*)0x2000009d = 0; *(uint8_t*)0x2000009e = 0; *(uint8_t*)0x2000009f = 0; *(uint8_t*)0x200000a0 = 0; *(uint8_t*)0x200000a1 = 0; *(uint8_t*)0x200000a2 = 0; *(uint8_t*)0x200000a3 = 0; *(uint8_t*)0x200000a4 = 0; *(uint8_t*)0x200000a5 = 0; *(uint8_t*)0x200000a6 = 0; *(uint8_t*)0x200000a7 = 0; *(uint8_t*)0x200000a8 = 0; *(uint8_t*)0x200000a9 = 0; *(uint8_t*)0x200000aa = 0; *(uint8_t*)0x200000ab = 0; *(uint8_t*)0x200000ac = 0; *(uint8_t*)0x200000ad = 0; *(uint8_t*)0x200000ae = 0; *(uint8_t*)0x200000af = 0; *(uint8_t*)0x200000b0 = 0; *(uint8_t*)0x200000b1 = 0; *(uint8_t*)0x200000b2 = 0; *(uint8_t*)0x200000b3 = 0; *(uint8_t*)0x200000b4 = 0; *(uint8_t*)0x200000b5 = 0; *(uint8_t*)0x200000b6 = 0; *(uint8_t*)0x200000b7 = 0; *(uint8_t*)0x200000b8 = 0; *(uint8_t*)0x200000b9 = 0; *(uint8_t*)0x200000ba = 0; *(uint8_t*)0x200000bb = 0; *(uint8_t*)0x200000bc = 0; *(uint8_t*)0x200000bd = 0; *(uint8_t*)0x200000be = 0; *(uint8_t*)0x200000bf = 0; *(uint8_t*)0x200000c0 = 0; *(uint8_t*)0x200000c1 = 0; *(uint8_t*)0x200000c2 = 0; *(uint8_t*)0x200000c3 = 0; *(uint8_t*)0x200000c4 = 0; *(uint8_t*)0x200000c5 = 0; *(uint8_t*)0x200000c6 = 0; *(uint8_t*)0x200000c7 = 0; *(uint8_t*)0x200000c8 = 0; *(uint8_t*)0x200000c9 = 0; *(uint8_t*)0x200000ca = 0; *(uint8_t*)0x200000cb = 0; *(uint8_t*)0x200000cc = 0; *(uint8_t*)0x200000cd = 0; *(uint8_t*)0x200000ce = 0; *(uint8_t*)0x200000cf = 0; *(uint8_t*)0x200000d0 = 0; *(uint8_t*)0x200000d1 = 0; *(uint8_t*)0x200000d2 = 0; *(uint8_t*)0x200000d3 = 0; *(uint8_t*)0x200000d4 = 0; *(uint8_t*)0x200000d5 = 0; *(uint8_t*)0x200000d6 = 0; *(uint8_t*)0x200000d7 = 0; *(uint8_t*)0x200000d8 = 0; *(uint8_t*)0x200000d9 = 0; *(uint8_t*)0x200000da = 0; *(uint8_t*)0x200000db = 0; *(uint8_t*)0x200000dc = 0; *(uint8_t*)0x200000dd = 0; *(uint8_t*)0x200000de = 0; *(uint8_t*)0x200000df = 0; *(uint8_t*)0x200000e0 = 0; *(uint8_t*)0x200000e1 = 0; *(uint8_t*)0x200000e2 = 0; *(uint8_t*)0x200000e3 = 0; *(uint8_t*)0x200000e4 = 0; *(uint8_t*)0x200000e5 = 0; *(uint8_t*)0x200000e6 = 0; *(uint8_t*)0x200000e7 = 0; *(uint8_t*)0x200000e8 = 0; *(uint8_t*)0x200000e9 = 0; *(uint8_t*)0x200000ea = 0; *(uint8_t*)0x200000eb = 0; *(uint8_t*)0x200000ec = 0; *(uint8_t*)0x200000ed = 0; *(uint8_t*)0x200000ee = 0; *(uint8_t*)0x200000ef = 0; *(uint8_t*)0x200000f0 = 0; *(uint8_t*)0x200000f1 = 0; *(uint8_t*)0x200000f2 = 0; *(uint8_t*)0x200000f3 = 0; *(uint8_t*)0x200000f4 = 0; *(uint8_t*)0x200000f5 = 0; *(uint8_t*)0x200000f6 = 0; *(uint8_t*)0x200000f7 = 0; *(uint8_t*)0x200000f8 = 0; *(uint8_t*)0x200000f9 = 0; *(uint8_t*)0x200000fa = 0; *(uint8_t*)0x200000fb = 0; *(uint8_t*)0x200000fc = 0; *(uint8_t*)0x200000fd = 0; *(uint8_t*)0x200000fe = 0; *(uint8_t*)0x200000ff = 0; *(uint8_t*)0x20000100 = 0; *(uint8_t*)0x20000101 = 0; *(uint8_t*)0x20000102 = 0; *(uint8_t*)0x20000103 = 0; *(uint8_t*)0x20000104 = 0; *(uint8_t*)0x20000105 = 0; *(uint8_t*)0x20000106 = 0; *(uint8_t*)0x20000107 = 0; *(uint8_t*)0x20000108 = 0; *(uint8_t*)0x20000109 = 0; *(uint8_t*)0x2000010a = 0; *(uint8_t*)0x2000010b = 0; *(uint8_t*)0x2000010c = 0; *(uint8_t*)0x2000010d = 0; *(uint8_t*)0x2000010e = 0; *(uint8_t*)0x2000010f = 0; *(uint32_t*)0x20000110 = 0x400; *(uint32_t*)0x20000114 = 0x2400; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint16_t*)0x20000120 = 8; *(uint16_t*)0x20000122 = 1; *(uint32_t*)0x20000124 = 2; *(uint16_t*)0x20000128 = 8; *(uint16_t*)0x2000012a = 1; *(uint32_t*)0x2000012c = 0x80; *(uint16_t*)0x20000130 = 8; *(uint16_t*)0x20000132 = 1; *(uint32_t*)0x20000134 = 0xd0406000; *(uint16_t*)0x20000138 = 8; *(uint16_t*)0x2000013a = 1; *(uint32_t*)0x2000013c = 1; *(uint16_t*)0x20000140 = 8; *(uint16_t*)0x20000142 = 1; *(uint32_t*)0x20000144 = 0x3ead9cbf; *(uint16_t*)0x20000148 = 8; *(uint16_t*)0x2000014a = 1; *(uint32_t*)0x2000014c = 3; *(uint16_t*)0x20000150 = 8; *(uint16_t*)0x20000152 = 1; *(uint32_t*)0x20000154 = 0; *(uint16_t*)0x20000158 = 8; *(uint16_t*)0x2000015a = 1; *(uint32_t*)0x2000015c = 0x800; *(uint16_t*)0x20000160 = 8; *(uint16_t*)0x20000162 = 1; *(uint32_t*)0x20000164 = 0; *(uint16_t*)0x20000168 = 8; *(uint16_t*)0x2000016a = 1; *(uint32_t*)0x2000016c = 1; *(uint64_t*)0x202ceff8 = 0x130; *(uint64_t*)0x2037ffe0 = 1; *(uint64_t*)0x2037ffe8 = 0; *(uint64_t*)0x2037fff0 = 0; *(uint32_t*)0x2037fff8 = 0x8820; syscall(__NR_sendmsg, r[1], 0x2037ffc8, 0x81); *(uint8_t*)0x20000100 = 0xaa; *(uint8_t*)0x20000101 = 0xaa; *(uint8_t*)0x20000102 = 0xaa; *(uint8_t*)0x20000103 = 0xaa; *(uint8_t*)0x20000104 = 0xaa; *(uint8_t*)0x20000105 = 0xaa; *(uint8_t*)0x20000106 = -1; *(uint8_t*)0x20000107 = -1; *(uint8_t*)0x20000108 = -1; *(uint8_t*)0x20000109 = -1; *(uint8_t*)0x2000010a = -1; *(uint8_t*)0x2000010b = -1; *(uint16_t*)0x2000010c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, 0x2000010e, 0, 0, 4); STORE_BY_BITMASK(uint8_t, 0x2000010e, 6, 4, 4); memcpy((void*)0x2000010f, "\xd8\x65\x2b", 3); *(uint16_t*)0x20000112 = htobe16(0x14); *(uint8_t*)0x20000114 = 6; *(uint8_t*)0x20000115 = 0; *(uint8_t*)0x20000116 = 0xfe; *(uint8_t*)0x20000117 = 0x7e; *(uint8_t*)0x20000118 = 0; *(uint8_t*)0x20000119 = 6; *(uint8_t*)0x2000011a = 0; *(uint8_t*)0x2000011b = 0; *(uint8_t*)0x2000011c = 0; *(uint8_t*)0x2000011d = 0; *(uint8_t*)0x2000011e = 0; *(uint8_t*)0x2000011f = 0; *(uint8_t*)0x20000120 = 0; *(uint8_t*)0x20000121 = 0; *(uint8_t*)0x20000122 = 0; *(uint8_t*)0x20000123 = 0; *(uint8_t*)0x20000124 = 0; *(uint8_t*)0x20000125 = 0xaa; *(uint8_t*)0x20000126 = 0xfe; *(uint8_t*)0x20000127 = 0x80; *(uint8_t*)0x20000128 = 0; *(uint8_t*)0x20000129 = 0; *(uint8_t*)0x2000012a = 0; *(uint8_t*)0x2000012b = 0; *(uint8_t*)0x2000012c = 0; *(uint8_t*)0x2000012d = 0; *(uint8_t*)0x2000012e = 0; *(uint8_t*)0x2000012f = 0; *(uint8_t*)0x20000130 = 0; *(uint8_t*)0x20000131 = 0; *(uint8_t*)0x20000132 = 0; *(uint8_t*)0x20000133 = 0; *(uint8_t*)0x20000134 = 0; *(uint8_t*)0x20000135 = 0xaa; *(uint16_t*)0x20000136 = htobe16(0); *(uint16_t*)0x20000138 = htobe16(0x4e20); *(uint32_t*)0x2000013a = 0x41424344; *(uint32_t*)0x2000013e = 0x41424344; STORE_BY_BITMASK(uint8_t, 0x20000142, 0, 0, 1); STORE_BY_BITMASK(uint8_t, 0x20000142, 0, 1, 3); STORE_BY_BITMASK(uint8_t, 0x20000142, 5, 4, 4); *(uint8_t*)0x20000143 = 0x10; *(uint16_t*)0x20000144 = htobe16(0); *(uint16_t*)0x20000146 = 0; *(uint16_t*)0x20000148 = htobe16(0); *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 0; *(uint32_t*)0x200002c8 = 0; *(uint32_t*)0x200002cc = 0; *(uint32_t*)0x200002d0 = 0; *(uint32_t*)0x200002d4 = 0; struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000116, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000126, 16); uint32_t csum_1_chunk_2 = 0x14000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x6000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000136, 20); *(uint16_t*)0x20000146 = csum_inet_digest(&csum_1); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }