// https://syzkaller.appspot.com/bug?id=898545a2e712628a74e5522390c09d983afdb05d // 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_ioctl #define SYS_ioctl 54 #endif #ifndef SYS_mmap #define SYS_mmap 197 #endif #ifndef SYS_msgsnd #define SYS_msgsnd 226 #endif #ifndef SYS_socket #define SYS_socket 394 #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; } } } uint64_t r[1] = {0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; *(uint64_t*)0x20000100 = 0; memcpy( (void*)0x20000108, "\x07\x74\xfc\x62\xc4\x89\xe6\xc6\x40\xa4\x2c\x65\x91\x97\xc5\x8c\x19\xe3" "\x48\x67\xd4\xc3\x04\x9e\xe6\xd3\x8f\xb2\x27\x1d\x17\x5f\x16\x28\xcb\x95" "\xbb\xa7\x14\x5f\x37\x57\x19\xc7\xad\x2b\xaf\xbd\x67\x17\xff\x3a\xb2\x80" "\xbe\x61\x92\xd7\xe5\x56\xac\x07\x7c\x35\x0c\xed\x68\x32\x32\xa9\x9c\xea" "\x10\x13\xb5\x7a\xf1\x97\x31\x65\x5b\x28\x6e\xda\x8b\x06\xaa\xfa\x47\xea" "\x0f\x93\x82\x73\x26\xe4\xd7\x40\xf3\x52\x22\xef\xad\x4d\xb5\xe8\x3c\xca" "\xc1\xfd\xe8\x52\xac\x44\x4d\x82\x1a\xd2\x6a\xdb\x7c\xfa\x13\x55\xfb\x07" "\x7c\x64\x14\x0c\x54\x53\xb2\x4b\x40\xf1\x69\x40\x70\x3d\x20\xa3\x18\x05" "\xd5\x0c\x59\xfc\x02\xf0\x7b\x94\xcd\xaa\x40\xfe\xf7", 157); syscall(SYS_msgsnd, /*msqid=*/0, /*msgp=*/0x20000100ul, /*sz=*/0xa5ul, /*flags=*/0ul); res = syscall(SYS_socket, /*domain=*/0x18ul, /*type=*/1ul, /*proto=*/0); if (res != -1) r[0] = res; *(uint64_t*)0x20000180 = 0x8000000000000032; syscall(SYS_ioctl, /*fd=*/r[0], /*cmd=*/0xc0106924ul, /*arg=*/0x20000180ul); } int main(void) { syscall(SYS_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/3ul, /*flags=*/0x1012ul, /*fd=*/-1, /*pad=*/0ul, /*offset=*/0ul); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { loop(); } } sleep(1000000); return 0; }