| // KMSAN: uninit-value in move_addr_to_user |
| // https://syzkaller.appspot.com/bug?id=7c86e19e2b252ed8113e07ed622699db13d3d2f4 |
| // status:fixed |
| // autogenerated by syzkaller (http://github.com/google/syzkaller) |
| |
| #define _GNU_SOURCE |
| #include <endian.h> |
| #include <stdint.h> |
| #include <string.h> |
| #include <sys/syscall.h> |
| #include <unistd.h> |
| |
| #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[1] = {0xffffffffffffffff}; |
| void loop() |
| { |
| long res = 0; |
| res = syscall(__NR_socket, 0xa, 5, 0x84); |
| if (res != -1) |
| r[0] = res; |
| *(uint16_t*)0x20223fd4 = 0xa; |
| *(uint16_t*)0x20223fd6 = htobe16(0x4e23); |
| *(uint32_t*)0x20223fd8 = 0; |
| *(uint8_t*)0x20223fdc = 0; |
| *(uint8_t*)0x20223fdd = 0; |
| *(uint8_t*)0x20223fde = 0; |
| *(uint8_t*)0x20223fdf = 0; |
| *(uint8_t*)0x20223fe0 = 0; |
| *(uint8_t*)0x20223fe1 = 0; |
| *(uint8_t*)0x20223fe2 = 0; |
| *(uint8_t*)0x20223fe3 = 0; |
| *(uint8_t*)0x20223fe4 = 0; |
| *(uint8_t*)0x20223fe5 = 0; |
| *(uint8_t*)0x20223fe6 = 0; |
| *(uint8_t*)0x20223fe7 = 0; |
| *(uint8_t*)0x20223fe8 = 0; |
| *(uint8_t*)0x20223fe9 = 0; |
| *(uint8_t*)0x20223fea = 0; |
| *(uint8_t*)0x20223feb = 0; |
| *(uint32_t*)0x20223fec = 0; |
| syscall(__NR_setsockopt, r[0], 0x84, 0x64, 0x20223fd4, 0x1c); |
| memcpy((void*)0x20ac0fbb, "\xc4", 1); |
| *(uint16_t*)0x206e2000 = 2; |
| *(uint16_t*)0x206e2002 = htobe16(0x4e23); |
| *(uint32_t*)0x206e2004 = htobe32(0x7f000001); |
| *(uint8_t*)0x206e2008 = 0; |
| *(uint8_t*)0x206e2009 = 0; |
| *(uint8_t*)0x206e200a = 0; |
| *(uint8_t*)0x206e200b = 0; |
| *(uint8_t*)0x206e200c = 0; |
| *(uint8_t*)0x206e200d = 0; |
| *(uint8_t*)0x206e200e = 0; |
| *(uint8_t*)0x206e200f = 0; |
| syscall(__NR_sendto, r[0], 0x20ac0fbb, 1, 0, 0x206e2000, 0x10); |
| *(uint32_t*)0x2056effc = 0; |
| syscall(__NR_setsockopt, r[0], 0x84, 0xc, 0x2056effc, 4); |
| *(uint64_t*)0x20003ac0 = 0x20003880; |
| *(uint32_t*)0x20003ac8 = 0x80; |
| *(uint64_t*)0x20003ad0 = 0x20003a40; |
| *(uint64_t*)0x20003ad8 = 0; |
| *(uint64_t*)0x20003ae0 = 0x20003a80; |
| *(uint64_t*)0x20003ae8 = 0x2f; |
| *(uint32_t*)0x20003af0 = 0; |
| *(uint32_t*)0x20003af8 = 0; |
| *(uint64_t*)0x20003bc0 = 0x77359400; |
| *(uint64_t*)0x20003bc8 = 0; |
| syscall(__NR_recvmmsg, r[0], 0x20003ac0, 1, 0, 0x20003bc0); |
| *(uint8_t*)0x200001c0 = 0xaa; |
| *(uint8_t*)0x200001c1 = 0xaa; |
| *(uint8_t*)0x200001c2 = 0xaa; |
| *(uint8_t*)0x200001c3 = 0xaa; |
| *(uint8_t*)0x200001c4 = 0xaa; |
| *(uint8_t*)0x200001c5 = 0xaa; |
| *(uint8_t*)0x200001c6 = 0; |
| *(uint8_t*)0x200001c7 = 0; |
| *(uint8_t*)0x200001c8 = 0; |
| *(uint8_t*)0x200001c9 = 0; |
| *(uint8_t*)0x200001ca = 0; |
| *(uint8_t*)0x200001cb = 0; |
| *(uint16_t*)0x200001cc = htobe16(0x86dd); |
| STORE_BY_BITMASK(uint8_t, 0x200001ce, 0, 0, 4); |
| STORE_BY_BITMASK(uint8_t, 0x200001ce, 6, 4, 4); |
| memcpy((void*)0x200001cf, "\x50\xa0\x9c", 3); |
| *(uint16_t*)0x200001d2 = htobe16(8); |
| *(uint8_t*)0x200001d4 = 0x2b; |
| *(uint8_t*)0x200001d5 = 0; |
| *(uint8_t*)0x200001d6 = 0xfe; |
| *(uint8_t*)0x200001d7 = 0x80; |
| *(uint8_t*)0x200001d8 = 0; |
| *(uint8_t*)0x200001d9 = 0; |
| *(uint8_t*)0x200001da = 0; |
| *(uint8_t*)0x200001db = 0; |
| *(uint8_t*)0x200001dc = 0; |
| *(uint8_t*)0x200001dd = 0; |
| *(uint8_t*)0x200001de = 0; |
| *(uint8_t*)0x200001df = 0; |
| *(uint8_t*)0x200001e0 = 0; |
| *(uint8_t*)0x200001e1 = 0; |
| *(uint8_t*)0x200001e2 = 0; |
| *(uint8_t*)0x200001e3 = 0; |
| *(uint8_t*)0x200001e4 = 0; |
| *(uint8_t*)0x200001e5 = 0xbb; |
| *(uint8_t*)0x200001e6 = 0xfe; |
| *(uint8_t*)0x200001e7 = 0x80; |
| *(uint8_t*)0x200001e8 = 0; |
| *(uint8_t*)0x200001e9 = 0; |
| *(uint8_t*)0x200001ea = 0; |
| *(uint8_t*)0x200001eb = 0; |
| *(uint8_t*)0x200001ec = 0; |
| *(uint8_t*)0x200001ed = 0; |
| *(uint8_t*)0x200001ee = 0; |
| *(uint8_t*)0x200001ef = 0; |
| *(uint8_t*)0x200001f0 = 0; |
| *(uint8_t*)0x200001f1 = 0; |
| *(uint8_t*)0x200001f2 = 0; |
| *(uint8_t*)0x200001f3 = 0; |
| *(uint8_t*)0x200001f4 = 0; |
| *(uint8_t*)0x200001f5 = 0xaa; |
| *(uint16_t*)0x200001f6 = htobe16(0); |
| *(uint16_t*)0x200001f8 = htobe16(0); |
| *(uint16_t*)0x200001fa = htobe16(8); |
| *(uint16_t*)0x200001fc = 0; |
| *(uint32_t*)0x20000040 = 0; |
| *(uint32_t*)0x20000044 = 0; |
| *(uint32_t*)0x20000048 = 0; |
| *(uint32_t*)0x2000004c = 0; |
| *(uint32_t*)0x20000050 = 0; |
| *(uint32_t*)0x20000054 = 0; |
| struct csum_inet csum_1; |
| csum_inet_init(&csum_1); |
| csum_inet_update(&csum_1, (const uint8_t*)0x200001d6, 16); |
| csum_inet_update(&csum_1, (const uint8_t*)0x200001e6, 16); |
| uint32_t csum_1_chunk_2 = 0x8000000; |
| csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 4); |
| uint32_t csum_1_chunk_3 = 0x11000000; |
| csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 4); |
| csum_inet_update(&csum_1, (const uint8_t*)0x200001f6, 8); |
| *(uint16_t*)0x200001fc = csum_inet_digest(&csum_1); |
| } |
| |
| int main() |
| { |
| syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); |
| loop(); |
| return 0; |
| } |