// https://syzkaller.appspot.com/bug?id=4e947674d10b0fb0cb94d4d723989cee439a71d6 // 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 = 0; res = syscall(__NR_socket, 0x10, 3, 6); if (res != -1) r[0] = res; *(uint64_t*)0x20646000 = 0x20000000; *(uint16_t*)0x20000000 = 0x10; *(uint16_t*)0x20000002 = 0; *(uint32_t*)0x20000004 = 0; *(uint32_t*)0x20000008 = 0; *(uint32_t*)0x20646008 = 0xc; *(uint64_t*)0x20646010 = 0x20f9bff0; *(uint64_t*)0x20f9bff0 = 0x20efe000; *(uint32_t*)0x20efe000 = 0xb8; *(uint16_t*)0x20efe004 = 0x19; *(uint16_t*)0x20efe006 = 0x401; *(uint32_t*)0x20efe008 = 0; *(uint32_t*)0x20efe00c = 0; *(uint8_t*)0x20efe010 = -1; *(uint8_t*)0x20efe011 = 2; *(uint8_t*)0x20efe012 = 0; *(uint8_t*)0x20efe013 = 0; *(uint8_t*)0x20efe014 = 0; *(uint8_t*)0x20efe015 = 0; *(uint8_t*)0x20efe016 = 0; *(uint8_t*)0x20efe017 = 0; *(uint8_t*)0x20efe018 = 0; *(uint8_t*)0x20efe019 = 0; *(uint8_t*)0x20efe01a = 0; *(uint8_t*)0x20efe01b = 0; *(uint8_t*)0x20efe01c = 0; *(uint8_t*)0x20efe01d = 0; *(uint8_t*)0x20efe01e = 0; *(uint8_t*)0x20efe01f = 1; *(uint8_t*)0x20efe020 = 0xac; *(uint8_t*)0x20efe021 = 0x14; *(uint8_t*)0x20efe022 = 0; *(uint8_t*)0x20efe023 = 0; *(uint16_t*)0x20efe030 = htobe16(0); *(uint16_t*)0x20efe032 = htobe16(0); *(uint16_t*)0x20efe034 = htobe16(0); *(uint16_t*)0x20efe036 = htobe16(0); *(uint16_t*)0x20efe038 = 0xa; *(uint8_t*)0x20efe03a = 0; *(uint8_t*)0x20efe03b = 0; *(uint8_t*)0x20efe03c = 0; *(uint32_t*)0x20efe040 = 0; *(uint32_t*)0x20efe044 = 0; *(uint64_t*)0x20efe048 = 0; *(uint64_t*)0x20efe050 = 0; *(uint64_t*)0x20efe058 = 0; *(uint64_t*)0x20efe060 = 0; *(uint64_t*)0x20efe068 = 0; *(uint64_t*)0x20efe070 = 0; *(uint64_t*)0x20efe078 = 0; *(uint64_t*)0x20efe080 = 0; *(uint64_t*)0x20efe088 = 0; *(uint64_t*)0x20efe090 = 0; *(uint64_t*)0x20efe098 = 0; *(uint64_t*)0x20efe0a0 = 0; *(uint32_t*)0x20efe0a8 = 0; *(uint32_t*)0x20efe0ac = 0; *(uint8_t*)0x20efe0b0 = 0; *(uint8_t*)0x20efe0b1 = 0; *(uint8_t*)0x20efe0b2 = 0; *(uint8_t*)0x20efe0b3 = 0; *(uint64_t*)0x20f9bff8 = 0xb8; *(uint64_t*)0x20646018 = 1; *(uint64_t*)0x20646020 = 0; *(uint64_t*)0x20646028 = 0; *(uint32_t*)0x20646030 = 0; syscall(__NR_sendmsg, r[0], 0x20646000, 0); res = syscall(__NR_socket, 2, 2, 0x88); if (res != -1) r[1] = res; *(uint16_t*)0x20000040 = 2; *(uint16_t*)0x20000042 = htobe16(0x4e20); *(uint32_t*)0x20000044 = htobe32(0x7f000001); *(uint8_t*)0x20000048 = 0; *(uint8_t*)0x20000049 = 0; *(uint8_t*)0x2000004a = 0; *(uint8_t*)0x2000004b = 0; *(uint8_t*)0x2000004c = 0; *(uint8_t*)0x2000004d = 0; *(uint8_t*)0x2000004e = 0; *(uint8_t*)0x2000004f = 0; syscall(__NR_bind, r[1], 0x20000040, 0x10); *(uint16_t*)0x20000080 = 2; *(uint16_t*)0x20000082 = htobe16(0x4e20); *(uint32_t*)0x20000084 = htobe32(0); *(uint8_t*)0x20000088 = 0; *(uint8_t*)0x20000089 = 0; *(uint8_t*)0x2000008a = 0; *(uint8_t*)0x2000008b = 0; *(uint8_t*)0x2000008c = 0; *(uint8_t*)0x2000008d = 0; *(uint8_t*)0x2000008e = 0; *(uint8_t*)0x2000008f = 0; syscall(__NR_sendto, r[1], 0x20000080, 0, 0x8084, 0x20000080, 0x10); *(uint16_t*)0x20df9ff0 = 2; *(uint16_t*)0x20df9ff2 = htobe16(0); *(uint32_t*)0x20df9ff4 = htobe32(0xe0000002); *(uint8_t*)0x20df9ff8 = 0; *(uint8_t*)0x20df9ff9 = 0; *(uint8_t*)0x20df9ffa = 0; *(uint8_t*)0x20df9ffb = 0; *(uint8_t*)0x20df9ffc = 0; *(uint8_t*)0x20df9ffd = 0; *(uint8_t*)0x20df9ffe = 0; *(uint8_t*)0x20df9fff = 0; syscall(__NR_sendto, r[1], 0x20000000, 0, 0, 0x20df9ff0, 0x10); *(uint8_t*)0x20000000 = 0xaa; *(uint8_t*)0x20000001 = 0xaa; *(uint8_t*)0x20000002 = 0xaa; *(uint8_t*)0x20000003 = 0xaa; *(uint8_t*)0x20000004 = 0xaa; *(uint8_t*)0x20000005 = 0xaa; memcpy((void*)0x20000006, "\x1a\x1e\xc9\x6a\x2d\xe6", 6); *(uint16_t*)0x2000000c = htobe16(0x86dd); STORE_BY_BITMASK(uint8_t, 0x2000000e, 0, 0, 4); STORE_BY_BITMASK(uint8_t, 0x2000000e, 6, 4, 4); memcpy((void*)0x2000000f, "\x6d\xd6\x95", 3); *(uint16_t*)0x20000012 = htobe16(0x30); *(uint8_t*)0x20000014 = 0x3b; *(uint8_t*)0x20000015 = 0; *(uint8_t*)0x20000016 = 0xfe; *(uint8_t*)0x20000017 = 0x80; *(uint8_t*)0x20000018 = 0; *(uint8_t*)0x20000019 = 0; *(uint8_t*)0x2000001a = 0; *(uint8_t*)0x2000001b = 0; *(uint8_t*)0x2000001c = 0; *(uint8_t*)0x2000001d = 0; *(uint8_t*)0x2000001e = 0; *(uint8_t*)0x2000001f = 0; *(uint8_t*)0x20000020 = 0; *(uint8_t*)0x20000021 = 0; *(uint8_t*)0x20000022 = 0; *(uint8_t*)0x20000023 = 0; *(uint8_t*)0x20000024 = 0; *(uint8_t*)0x20000025 = 0; *(uint8_t*)0x20000026 = 0; *(uint8_t*)0x20000027 = 0; *(uint8_t*)0x20000028 = 0; *(uint8_t*)0x20000029 = 0; *(uint8_t*)0x2000002a = 0; *(uint8_t*)0x2000002b = 0; *(uint8_t*)0x2000002c = 0; *(uint8_t*)0x2000002d = 0; *(uint8_t*)0x2000002e = 0; *(uint8_t*)0x2000002f = 0; *(uint8_t*)0x20000030 = 0; *(uint8_t*)0x20000031 = 0; *(uint8_t*)0x20000032 = 0; *(uint8_t*)0x20000033 = 0; *(uint8_t*)0x20000034 = 0; *(uint8_t*)0x20000035 = 0; *(uint8_t*)0x20000036 = 2; *(uint8_t*)0x20000037 = 0; *(uint16_t*)0x20000038 = 0; *(uint32_t*)0x2000003a = htobe32(0); STORE_BY_BITMASK(uint8_t, 0x2000003e, 0, 0, 4); STORE_BY_BITMASK(uint8_t, 0x2000003e, 6, 4, 4); memcpy((void*)0x2000003f, "\x26\x0c\x2b", 3); *(uint16_t*)0x20000042 = htobe16(0); *(uint8_t*)0x20000044 = 0; *(uint8_t*)0x20000045 = 0; *(uint8_t*)0x20000046 = 0xfe; *(uint8_t*)0x20000047 = 0x80; *(uint8_t*)0x20000048 = 0; *(uint8_t*)0x20000049 = 0; *(uint8_t*)0x2000004a = 0; *(uint8_t*)0x2000004b = 0; *(uint8_t*)0x2000004c = 0; *(uint8_t*)0x2000004d = 0; *(uint8_t*)0x2000004e = 0; *(uint8_t*)0x2000004f = 0; *(uint8_t*)0x20000050 = 0; *(uint8_t*)0x20000051 = 0; *(uint8_t*)0x20000052 = 0; *(uint8_t*)0x20000053 = 0; *(uint8_t*)0x20000054 = 0; *(uint8_t*)0x20000055 = 0; *(uint8_t*)0x20000056 = -1; *(uint8_t*)0x20000057 = 2; *(uint8_t*)0x20000058 = 0; *(uint8_t*)0x20000059 = 0; *(uint8_t*)0x2000005a = 0; *(uint8_t*)0x2000005b = 0; *(uint8_t*)0x2000005c = 0; *(uint8_t*)0x2000005d = 0; *(uint8_t*)0x2000005e = 0; *(uint8_t*)0x2000005f = 0; *(uint8_t*)0x20000060 = 0; *(uint8_t*)0x20000061 = 0; *(uint8_t*)0x20000062 = 0; *(uint8_t*)0x20000063 = 0; *(uint8_t*)0x20000064 = 0; *(uint8_t*)0x20000065 = 1; *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = 0; *(uint32_t*)0x200000c8 = 0; *(uint32_t*)0x200000cc = 0x144; *(uint32_t*)0x200000d0 = 0; *(uint32_t*)0x200000d4 = 0xc8e; struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000016, 16); csum_inet_update(&csum_1, (const uint8_t*)0x20000026, 16); uint32_t csum_1_chunk_2 = 0x30000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); uint32_t csum_1_chunk_3 = 0x3a000000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); csum_inet_update(&csum_1, (const uint8_t*)0x20000036, 48); *(uint16_t*)0x20000038 = csum_inet_digest(&csum_1); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }