// https://syzkaller.appspot.com/bug?id=abb6cc54bd2802dfdeb0978f7adf870325b80f92 // 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[43]; 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*)0x209fefef, "\x6e\x65\x74\x2f\x69\x70\x36\x5f\x6d\x72" "\x5f\x63\x61\x63\x68\x65\x00", 17); r[2] = syz_open_procfs(0x0ul, 0x209fefeful); break; case 2: *(uint64_t*)0x20a3afb0 = (uint64_t)0x20128000; *(uint64_t*)0x20a3afb8 = (uint64_t)0x2; r[5] = syscall(__NR_preadv, r[2], 0x20a3afb0ul, 0x1ul, 0x67ul); break; case 3: r[6] = syscall(__NR_socket, 0xaul, 0x3ul, 0x3aul); break; case 4: *(uint16_t*)0x20f07000 = (uint16_t)0xa; *(uint16_t*)0x20f07002 = (uint16_t)0x224e; *(uint32_t*)0x20f07004 = (uint32_t)0xffffffff; *(uint64_t*)0x20f07008 = (uint64_t)0x0; *(uint64_t*)0x20f07010 = (uint64_t)0x100000000000000; *(uint32_t*)0x20f07018 = (uint32_t)0x6; *(uint16_t*)0x20f0701c = (uint16_t)0xa; *(uint16_t*)0x20f0701e = (uint16_t)0x204e; *(uint32_t*)0x20f07020 = (uint32_t)0x4; *(uint8_t*)0x20f07024 = (uint8_t)0x0; *(uint8_t*)0x20f07025 = (uint8_t)0x0; *(uint8_t*)0x20f07026 = (uint8_t)0x0; *(uint8_t*)0x20f07027 = (uint8_t)0x0; *(uint8_t*)0x20f07028 = (uint8_t)0x0; *(uint8_t*)0x20f07029 = (uint8_t)0x0; *(uint8_t*)0x20f0702a = (uint8_t)0x0; *(uint8_t*)0x20f0702b = (uint8_t)0x0; *(uint8_t*)0x20f0702c = (uint8_t)0x0; *(uint8_t*)0x20f0702d = (uint8_t)0x0; *(uint8_t*)0x20f0702e = (uint8_t)0x0; *(uint8_t*)0x20f0702f = (uint8_t)0x0; *(uint8_t*)0x20f07030 = (uint8_t)0x0; *(uint8_t*)0x20f07031 = (uint8_t)0x0; *(uint8_t*)0x20f07032 = (uint8_t)0x0; *(uint8_t*)0x20f07033 = (uint8_t)0x0; *(uint32_t*)0x20f07034 = (uint32_t)0x5; *(uint16_t*)0x20f07038 = (uint16_t)0x1; *(uint32_t*)0x20f0703c = (uint32_t)0x7fffffff; *(uint32_t*)0x20f07040 = (uint32_t)0x61; *(uint32_t*)0x20f07044 = (uint32_t)0xfff; *(uint32_t*)0x20f07048 = (uint32_t)0x0; *(uint32_t*)0x20f0704c = (uint32_t)0x0; *(uint32_t*)0x20f07050 = (uint32_t)0x4; *(uint32_t*)0x20f07054 = (uint32_t)0x100000001; *(uint32_t*)0x20f07058 = (uint32_t)0x6; r[42] = syscall(__NR_setsockopt, r[6], 0x29ul, 0xccul, 0x20f07000ul, 0x5cul); break; } return 0; } void test() { long i; pthread_t th[10]; memset(r, -1, sizeof(r)); srand(getpid()); for (i = 0; i < 5; i++) { pthread_create(&th[i], 0, thr, (void*)i); usleep(rand() % 10000); } for (i = 0; i < 5; i++) { pthread_create(&th[5 + i], 0, thr, (void*)i); if (rand() % 2) usleep(rand() % 10000); } usleep(rand() % 100000); } int main() { loop(); return 0; }