// https://syzkaller.appspot.com/bug?id=b23d95999136f86da560efe4adcfef2381a3b584 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include static uintptr_t syz_open_procfs(uintptr_t a0, uintptr_t a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == (uintptr_t)-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; } static void test(); void loop() { while (1) { test(); } } long r[60]; void* thr(void* arg) { switch ((long)arg) { case 0: r[0] = syscall(__NR_mmap, 0x20000000ul, 0xfff000ul, 0x3ul, 0x32ul, 0xfffffffffffffffful, 0x0ul); break; case 1: memcpy((void*)0x20bb8000, "\x6e\x65\x74\x2f\x69\x70\x36\x5f\x6d\x72" "\x5f\x63\x61\x63\x68\x65\x00", 17); r[2] = syz_open_procfs(0x0ul, 0x20bb8000ul); break; case 2: r[3] = syscall(__NR_pread64, r[2], 0x20caef7bul, 0x0ul, 0x4cul); break; case 3: *(uint64_t*)0x20917fb0 = (uint64_t)0x20131f47; *(uint64_t*)0x20917fb8 = (uint64_t)0x6; *(uint64_t*)0x20917fc0 = (uint64_t)0x20a87f2b; *(uint64_t*)0x20917fc8 = (uint64_t)0x62; r[8] = syscall(__NR_readv, r[2], 0x20917fb0ul, 0x2ul); break; case 4: r[9] = syscall(__NR_socket, 0xaul, 0x2ul, 0x0ul); break; case 5: *(uint16_t*)0x206a4fa4 = (uint16_t)0xa; *(uint16_t*)0x206a4fa6 = (uint16_t)0x204e; *(uint32_t*)0x206a4fa8 = (uint32_t)0x0; *(uint8_t*)0x206a4fac = (uint8_t)0xfe; *(uint8_t*)0x206a4fad = (uint8_t)0x80; *(uint8_t*)0x206a4fae = (uint8_t)0x0; *(uint8_t*)0x206a4faf = (uint8_t)0x0; *(uint8_t*)0x206a4fb0 = (uint8_t)0x0; *(uint8_t*)0x206a4fb1 = (uint8_t)0x0; *(uint8_t*)0x206a4fb2 = (uint8_t)0x0; *(uint8_t*)0x206a4fb3 = (uint8_t)0x0; *(uint8_t*)0x206a4fb4 = (uint8_t)0x0; *(uint8_t*)0x206a4fb5 = (uint8_t)0x0; *(uint8_t*)0x206a4fb6 = (uint8_t)0x0; *(uint8_t*)0x206a4fb7 = (uint8_t)0x0; *(uint8_t*)0x206a4fb8 = (uint8_t)0x0; *(uint8_t*)0x206a4fb9 = (uint8_t)0x0; *(uint8_t*)0x206a4fba = (uint8_t)0x0; *(uint8_t*)0x206a4fbb = (uint8_t)0xaa; *(uint32_t*)0x206a4fbc = (uint32_t)0x0; *(uint16_t*)0x206a4fc0 = (uint16_t)0xa; *(uint16_t*)0x206a4fc2 = (uint16_t)0x204e; *(uint32_t*)0x206a4fc4 = (uint32_t)0x0; *(uint8_t*)0x206a4fc8 = (uint8_t)0x0; *(uint8_t*)0x206a4fc9 = (uint8_t)0x0; *(uint8_t*)0x206a4fca = (uint8_t)0x0; *(uint8_t*)0x206a4fcb = (uint8_t)0x0; *(uint8_t*)0x206a4fcc = (uint8_t)0x0; *(uint8_t*)0x206a4fcd = (uint8_t)0x0; *(uint8_t*)0x206a4fce = (uint8_t)0x0; *(uint8_t*)0x206a4fcf = (uint8_t)0x0; *(uint8_t*)0x206a4fd0 = (uint8_t)0x0; *(uint8_t*)0x206a4fd1 = (uint8_t)0x0; *(uint8_t*)0x206a4fd2 = (uint8_t)0x0; *(uint8_t*)0x206a4fd3 = (uint8_t)0x0; *(uint8_t*)0x206a4fd4 = (uint8_t)0x0; *(uint8_t*)0x206a4fd5 = (uint8_t)0x0; *(uint8_t*)0x206a4fd6 = (uint8_t)0x0; *(uint8_t*)0x206a4fd7 = (uint8_t)0x0; *(uint32_t*)0x206a4fd8 = (uint32_t)0x0; *(uint16_t*)0x206a4fdc = (uint16_t)0x0; *(uint32_t*)0x206a4fe0 = (uint32_t)0xf67; *(uint32_t*)0x206a4fe4 = (uint32_t)0x0; *(uint32_t*)0x206a4fe8 = (uint32_t)0x0; *(uint32_t*)0x206a4fec = (uint32_t)0x0; *(uint32_t*)0x206a4ff0 = (uint32_t)0x0; *(uint32_t*)0x206a4ff4 = (uint32_t)0x0; *(uint32_t*)0x206a4ff8 = (uint32_t)0x0; *(uint32_t*)0x206a4ffc = (uint32_t)0x0; r[59] = syscall(__NR_setsockopt, r[9], 0x29ul, 0xd2ul, 0x206a4fa4ul, 0x5cul); break; } return 0; } void test() { long i; pthread_t th[12]; memset(r, -1, sizeof(r)); srand(getpid()); for (i = 0; i < 6; i++) { pthread_create(&th[i], 0, thr, (void*)i); usleep(rand() % 10000); } for (i = 0; i < 6; i++) { pthread_create(&th[6 + i], 0, thr, (void*)i); if (rand() % 2) usleep(rand() % 10000); } usleep(rand() % 100000); } int main() { loop(); return 0; }