// https://syzkaller.appspot.com/bug?id=0db3a79a06a7c545c6aca0cb3ff263e57837ab3b // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #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)))) static long syz_open_procfs(volatile long a0, volatile long a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == -1) { snprintf(buf, sizeof(buf), "/proc/thread-self/%s", (char*)a1); } else { snprintf(buf, sizeof(buf), "/proc/self/task/%d/%s", (int)a0, (char*)a1); } int fd = open(buf, O_RDWR); if (fd == -1) fd = open(buf, O_RDONLY); return fd; } uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0}; int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); intptr_t res = 0; memcpy((void*)0x20000100, "syscall\000", 8); syz_open_procfs(0, 0x20000100); res = syscall(__NR_socket, 0x10ul, 3ul, 0); if (res != -1) r[0] = res; res = syscall(__NR_socket, 1ul, 0x803ul, 0); if (res != -1) r[1] = res; *(uint32_t*)0x200002c0 = 0x14; res = syscall(__NR_getsockname, r[1], 0x20000100ul, 0x200002c0ul); if (res != -1) r[2] = *(uint32_t*)0x20000104; *(uint64_t*)0x20000080 = 0; *(uint32_t*)0x20000088 = 0; *(uint64_t*)0x20000090 = 0x20000000; *(uint64_t*)0x20000000 = 0x20000300; *(uint32_t*)0x20000300 = 0x9c; *(uint16_t*)0x20000304 = 0x10; *(uint16_t*)0x20000306 = 0x401; *(uint32_t*)0x20000308 = 0x70bd27; *(uint32_t*)0x2000030c = 0x25dfdbfd; *(uint8_t*)0x20000310 = 0; *(uint8_t*)0x20000311 = 0; *(uint16_t*)0x20000312 = 0; *(uint32_t*)0x20000314 = 0; *(uint32_t*)0x20000318 = 0; *(uint32_t*)0x2000031c = 0; *(uint16_t*)0x20000320 = 0x74; STORE_BY_BITMASK(uint16_t, , 0x20000322, 0x12, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000323, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000323, 1, 7, 1); *(uint16_t*)0x20000324 = 0xe; *(uint16_t*)0x20000326 = 1; memcpy((void*)0x20000328, "ip6erspan\000", 10); *(uint16_t*)0x20000334 = 0x60; STORE_BY_BITMASK(uint16_t, , 0x20000336, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000337, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000337, 1, 7, 1); *(uint16_t*)0x20000338 = 8; *(uint16_t*)0x2000033a = 0x15; *(uint32_t*)0x2000033c = 0x82601; *(uint16_t*)0x20000340 = 6; *(uint16_t*)0x20000342 = 0xf; *(uint16_t*)0x20000344 = 2; *(uint16_t*)0x20000348 = 4; *(uint16_t*)0x2000034a = 0x12; *(uint16_t*)0x2000034c = 8; *(uint16_t*)0x2000034e = 0xc; *(uint32_t*)0x20000350 = 9; *(uint16_t*)0x20000354 = 5; *(uint16_t*)0x20000356 = 0x16; *(uint8_t*)0x20000358 = 1; *(uint16_t*)0x2000035c = 8; *(uint16_t*)0x2000035e = 0x15; *(uint32_t*)0x20000360 = 0x9bde8; *(uint16_t*)0x20000364 = 1; *(uint16_t*)0x20000366 = 6; memcpy((void*)0x20000368, " \001\000\000\000\000\000\000\000\000\000\000\000\000\000\002", 16); *(uint16_t*)0x20000378 = 0x14; *(uint16_t*)0x2000037a = 6; *(uint64_t*)0x2000037c = htobe64(0); *(uint64_t*)0x20000384 = htobe64(1); *(uint16_t*)0x2000038c = 5; *(uint16_t*)0x2000038e = 8; *(uint8_t*)0x20000390 = 0xa9; *(uint16_t*)0x20000394 = 8; *(uint16_t*)0x20000396 = 3; *(uint32_t*)0x20000398 = r[2]; *(uint64_t*)0x20000008 = 0x9c; *(uint64_t*)0x20000098 = 1; *(uint64_t*)0x200000a0 = 0; *(uint64_t*)0x200000a8 = 0; *(uint32_t*)0x200000b0 = 0; syscall(__NR_sendmsg, r[0], 0x20000080ul, 0x20001000ul); return 0; }