// 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; res = syscall(__NR_socket, 0xf, 3, 2); if (res != -1) r[0] = res; *(uint64_t*)0x20360000 = 0; *(uint32_t*)0x20360008 = 0; *(uint64_t*)0x20360010 = 0x2035d000; *(uint64_t*)0x2035d000 = 0x200001c0; memcpy((void*)0x200001c0, "\x02\x0d\x00\x00\x10\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x03" "\x00\x06\x00\x00\x00\x00\x00\x02\x00\x00\x00\x31\xeb\xf8\xc7\x00\x00" "\x00\x00\x00\x00\x00\x00\x03\x00\x05\x00\x00\x00\x00\x00\x02\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x12\x00" "\x02\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x03" "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x00\x00\x01\x01\x00" "\xc5\x8a\x47\x56\x6f\x8d\x45\x15\x7c\x97\xec\x3a\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00", 128); *(uint64_t*)0x2035d008 = 0x80; *(uint64_t*)0x20360018 = 1; *(uint64_t*)0x20360020 = 0; *(uint64_t*)0x20360028 = 0; *(uint32_t*)0x20360030 = 0; syscall(__NR_sendmsg, r[0], 0x20360000, 0); res = syscall(__NR_socket, 2, 2, 0x88); if (res != -1) r[1] = res; *(uint16_t*)0x20b9aff0 = 2; *(uint16_t*)0x20b9aff2 = htobe16(0x4e20); *(uint32_t*)0x20b9aff4 = htobe32(0); *(uint8_t*)0x20b9aff8 = 0; *(uint8_t*)0x20b9aff9 = 0; *(uint8_t*)0x20b9affa = 0; *(uint8_t*)0x20b9affb = 0; *(uint8_t*)0x20b9affc = 0; *(uint8_t*)0x20b9affd = 0; *(uint8_t*)0x20b9affe = 0; *(uint8_t*)0x20b9afff = 0; syscall(__NR_bind, r[1], 0x20b9aff0, 0x10); *(uint16_t*)0x20319ff0 = 2; *(uint16_t*)0x20319ff2 = htobe16(0x4e20); *(uint32_t*)0x20319ff4 = htobe32(0); *(uint8_t*)0x20319ff8 = 0; *(uint8_t*)0x20319ff9 = 0; *(uint8_t*)0x20319ffa = 0; *(uint8_t*)0x20319ffb = 0; *(uint8_t*)0x20319ffc = 0; *(uint8_t*)0x20319ffd = 0; *(uint8_t*)0x20319ffe = 0; *(uint8_t*)0x20319fff = 0; syscall(__NR_sendto, r[1], 0x20e7c000, 0, 0x8084, 0x20319ff0, 0x10); *(uint16_t*)0x2082dff0 = 2; *(uint16_t*)0x2082dff2 = htobe16(0); *(uint8_t*)0x2082dff4 = 0xac; *(uint8_t*)0x2082dff5 = 0x14; *(uint8_t*)0x2082dff6 = 0x14; *(uint8_t*)0x2082dff7 = 0xaa; *(uint8_t*)0x2082dff8 = 0; *(uint8_t*)0x2082dff9 = 0; *(uint8_t*)0x2082dffa = 0; *(uint8_t*)0x2082dffb = 0; *(uint8_t*)0x2082dffc = 0; *(uint8_t*)0x2082dffd = 0; *(uint8_t*)0x2082dffe = 0; *(uint8_t*)0x2082dfff = 0; syscall(__NR_sendto, r[1], 0x20000000, 0, 0, 0x2082dff0, 0x10); *(uint8_t*)0x208a6000 = 1; *(uint8_t*)0x208a6001 = 0x80; *(uint8_t*)0x208a6002 = 0xc2; *(uint8_t*)0x208a6003 = 0; *(uint8_t*)0x208a6004 = 0; *(uint8_t*)0x208a6005 = 0; memcpy((void*)0x208a6006, "\x7d\x73\xcf\x61\x10\x0f", 6); *(uint16_t*)0x208a600c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, 0x208a600e, 5, 0, 4); STORE_BY_BITMASK(uint8_t, 0x208a600e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, 0x208a600f, 0, 0, 2); STORE_BY_BITMASK(uint8_t, 0x208a600f, 0, 2, 6); *(uint16_t*)0x208a6010 = htobe16(0x1c); *(uint16_t*)0x208a6012 = htobe16(0); *(uint16_t*)0x208a6014 = htobe16(0); *(uint8_t*)0x208a6016 = 0; *(uint8_t*)0x208a6017 = 2; *(uint16_t*)0x208a6018 = 0; *(uint32_t*)0x208a601a = htobe32(0); *(uint32_t*)0x208a601e = htobe32(-1); *(uint8_t*)0x208a6022 = 0x16; *(uint8_t*)0x208a6023 = 0; *(uint16_t*)0x208a6024 = 0; *(uint32_t*)0x208a6026 = htobe32(0xe0000002); *(uint32_t*)0x20000000 = 0; *(uint32_t*)0x20000004 = 0; *(uint32_t*)0x20000008 = 0; *(uint32_t*)0x2000000c = 0; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = 0; struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x208a6022, 8); *(uint16_t*)0x208a6024 = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x208a600e, 20); *(uint16_t*)0x208a6018 = csum_inet_digest(&csum_2); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }