// https://syzkaller.appspot.com/bug?id=1f4ddab55bcaf38ad92dc0291a878c7842f10eae // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef SYS___mount50 #define SYS___mount50 410 #endif #ifndef SYS__lwp_create #define SYS__lwp_create 309 #endif #ifndef SYS_compat_40_mount #define SYS_compat_40_mount 21 #endif #ifndef SYS_mmap #define SYS_mmap 197 #endif #ifndef SYS_setsockopt #define SYS_setsockopt 105 #endif static unsigned long long procid; static void kill_and_wait(int pid, int* status) { kill(pid, SIGKILL); while (waitpid(-1, status, 0) != pid) { } } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void execute_one(void); #define WAIT_FLAGS 0 static void loop(void) { int iter = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } void execute_one(void) { memcpy((void*)0x20000180, "\x1f\x95\x70\xae\x4d\x44\xf7\x21\xc0\x83\xdc\x13\xc7\xc1\x6c\xba\x6b" "\x21\xd1\x48\x23\x65\x74\x5f\x3d\x71\x4c\x70\x95\x43\xeb\x28\x0e\x17" "\x42\x38\xee\x72\xf7\x9e\x21\x11\x39\x88\x9f\x05\xe2\x6a\x6f\x8c\x23" "\x2d\x34\xa9\x36\x57\x53\xbf\x81\xb5\xa9\xbf\x2b\x12\x48\x01\x04\x95" "\x49\x17\x3e\x23\xdd\x3c\x1d\x83\x71\xe6\x23\xc6\x88\xec\xeb\x8e\x13" "\x12\xf9\x2e\x7f\x4c\xf9\xe0\x8e\xc4\xe9\xe3\x86\x22\x97\x63\xc4\xfa" "\x3d\xd4\x1a\xc6\xb7\x61\x82\x92\x7e\xc7\x9b\x41\x6a\x2e\x08\x40\xbe" "\xff\xac\xc6\xfc\x97\x72\x4c\x4b\x41\xce\x76\xfb\x38\x12", 133); syscall(SYS_setsockopt, /*fd=*/-1, /*level=*/3, /*optname=*/7, /*optval=*/0x20000180ul, /*optlen=*/0x85ul); memcpy((void*)0x20000380, "tmpfs\000", 6); memcpy((void*)0x200003c0, ".\000", 2); memset((void*)0x20000140, 1, 1); syscall(SYS_compat_40_mount, /*type=*/0x20000380ul, /*path=*/0x200003c0ul, /*flags=*/0ul, /*data=*/0x20000140ul); *(uint32_t*)0x20000100 = 0; *(uint64_t*)0x20000108 = 0; *(uint32_t*)0x20000110 = 0; *(uint32_t*)0x20000114 = 0; *(uint32_t*)0x20000118 = 0; *(uint32_t*)0x2000011c = 0; *(uint64_t*)0x20000120 = 0; *(uint64_t*)0x20000128 = 0; *(uint32_t*)0x20000130 = 0; *(uint64_t*)0x20000138 = 0; *(uint64_t*)0x20000140 = 0; memcpy((void*)0x20000148, "/)!/\000", 5); syscall(SYS__lwp_create, /*uc=*/0x20000100ul, /*flags=*/0ul, /*new_lwp=*/0ul); memcpy((void*)0x20000040, ".\000", 2); syscall( SYS___mount50, /*type=*/0ul, /*path=*/0x20000040ul, /*flags=MNT_QUOTA|MNT_EXNORESPORT|MNT_EXKERB|MNT_DEFEXPORTED|MNT_EXPORTED|MNT_EXRDONLY|0xe680bf986521807b*/ 0xe680bf986d21abfbul, /*data=*/0x20000140ul, /*len=*/0ul); } int main(void) { syscall(SYS_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ*/ 3ul, /*flags=MAP_PRIVATE|MAP_FIXED|MAP_ANON*/ 0x1012ul, /*fd=*/-1, /*pad=*/0ul, /*offset=*/0ul); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }