// https://syzkaller.appspot.com/bug?id=c789cee64bddb909207864cf848b4357a6b90b9c // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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; } #define CAST 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[4] = {0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(shmget))(/*key=*/0, /*size=*/0x3000, /*flags=*/0, /*unused=*/0x20ffa000); if (res != -1) r[0] = res; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(shmat))(/*shmid=*/r[0], /*addr=*/0x20001000, /*flags=*/0); *(uint64_t*)0x20000000 = 0x10; *(uint64_t*)0x20000008 = 0; *(uint64_t*)0x20000010 = 0x20fff000; *(uint64_t*)0x20000018 = 0x20ff4000; *(uint64_t*)0x20000020 = 0x40000; *(uint64_t*)0x20000028 = 0; *(uint64_t*)0x20000030 = 0; *(uint64_t*)0x20000038 = 0; *(uint64_t*)0x20000040 = 0x20ff3000; *(uint64_t*)0x20000048 = 0x20ffb000; *(uint64_t*)0x20000050 = 0; *(uint64_t*)0x20000058 = 0; *(uint64_t*)0x20000060 = 0; *(uint64_t*)0x20000068 = 0; *(uint64_t*)0x20000070 = 0; *(uint64_t*)0x20000078 = 0x20ffb000; *(uint64_t*)0x20000080 = 0; *(uint64_t*)0x20000088 = 0x20ffd000; *(uint64_t*)0x20000090 = 0x20008000; *(uint64_t*)0x20000098 = 0; *(uint64_t*)0x200000a0 = 0; *(uint64_t*)0x200000a8 = 0x20fef000; *(uint64_t*)0x200000b0 = 0; *(uint64_t*)0x200000b8 = 0x20ffa000; *(uint64_t*)0x200000c0 = 0x20004000; *(uint64_t*)0x200000c8 = 0; *(uint64_t*)0x200000d0 = 0; *(uint64_t*)0x200000d8 = 0x20ffb000; *(uint64_t*)0x200000e0 = 0; *(uint64_t*)0x200000e8 = 0x20ff1000; *(uint64_t*)0x200000f0 = 0x20ff9000; *(uint64_t*)0x200000f8 = 0; *(uint64_t*)0x20000100 = 0x20ffe000; *(uint64_t*)0x20000108 = 0x20ff9000; *(uint64_t*)0x20000110 = 0; *(uint64_t*)0x20000118 = 0x20fef000; *(uint64_t*)0x20000120 = 0x20ffd000; *(uint64_t*)0x20000128 = 0; *(uint64_t*)0x20000130 = 0x20007000; *(uint64_t*)0x20000138 = 0x20ffd000; *(uint64_t*)0x20000140 = 0; *(uint64_t*)0x20000148 = 0x20ff3000; *(uint64_t*)0x20000150 = 0x20ff9000; *(uint64_t*)0x20000158 = 0; *(uint64_t*)0x20000160 = 0x20ff5000; *(uint64_t*)0x20000168 = 0x20ffa000; *(uint64_t*)0x20000170 = 0; *(uint64_t*)0x20000178 = 0x20ffa000; *(uint64_t*)0x20000180 = 0x20ffd000; *(uint64_t*)0x20000188 = 0; memcpy((void*)0x20000190, "./file1\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 64); *(uint32_t*)0x200001d0 = 9; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(ioctl))(/*fd=*/-1, /*cmd=*/0xc5005601, /*arg=*/0x20000000); memcpy((void*)0x20000500, "/dev/vmm\000", 9); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000500, /*flags=*/0, /*mode=*/0); if (res != -1) r[1] = res; *(uint32_t*)0x20000000 = 1; *(uint32_t*)0x20000004 = 0; *(uint8_t*)0x20000008 = 1; *(uint16_t*)0x2000000a = 0; *(uint64_t*)0x20000010 = 0; *(uint16_t*)0x20000018 = 0; *(uint8_t*)0x2000001a = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(ioctl))(/*fd=*/r[1], /*cmd=*/0xc2585601, /*arg=*/0x20000000); ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(socketpair))(/*domain=*/1, /*type=SOCK_STREAM*/1, /*proto=*/0, /*fds=*/0); memcpy((void*)0x20000240, "/dev/vmm\000", 9); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000240, /*flags=*/0, /*mode=*/0); if (res != -1) r[2] = res; *(uint32_t*)0x20000480 = 3; *(uint32_t*)0x20000484 = 0; *(uint64_t*)0x20000488 = 0; *(uint64_t*)0x20000490 = 0; *(uint64_t*)0x20000498 = 0; *(uint64_t*)0x200004a0 = 0; *(uint64_t*)0x200004a8 = 0; *(uint64_t*)0x200004b0 = 0; *(uint64_t*)0x200004b8 = 0x8000000000; *(uint64_t*)0x200004c0 = 0; *(uint64_t*)0x200004c8 = 0; *(uint64_t*)0x200004d0 = 0; *(uint64_t*)0x200004d8 = 0; *(uint64_t*)0x200004e0 = 0; *(uint64_t*)0x200004e8 = 0; *(uint64_t*)0x200004f0 = 0; *(uint64_t*)0x200004f8 = 0; *(uint64_t*)0x20000500 = 0; *(uint64_t*)0x20000508 = 0; *(uint64_t*)0x20000510 = 0; *(uint64_t*)0x20000518 = 0xfffffffffffffffd; *(uint64_t*)0x20000520 = 0; *(uint64_t*)0x20000528 = 0x20000a5; *(uint64_t*)0x20000530 = 0x3f; *(uint64_t*)0x20000538 = 0; *(uint64_t*)0x20000540 = 0; *(uint64_t*)0x20000548 = 0; *(uint64_t*)0x20000550 = 0; *(uint64_t*)0x20000558 = 0; *(uint64_t*)0x20000560 = 0; *(uint64_t*)0x20000568 = 0xfffffffffffffffe; *(uint64_t*)0x20000570 = 0; *(uint64_t*)0x20000578 = 0; *(uint64_t*)0x20000580 = 0; *(uint64_t*)0x20000588 = 0; *(uint64_t*)0x20000590 = 0; *(uint64_t*)0x20000598 = 0; *(uint64_t*)0x200005a0 = 0; *(uint64_t*)0x200005a8 = 0; *(uint64_t*)0x200005b0 = 0; *(uint64_t*)0x200005b8 = 0xfffffffffffffffd; *(uint64_t*)0x200005c0 = 0xffffffffffffffe1; *(uint64_t*)0x200005c8 = 0; *(uint16_t*)0x200005d0 = 0x80; *(uint32_t*)0x200005d4 = 6; *(uint32_t*)0x200005d8 = 0; *(uint64_t*)0x200005e0 = 0; *(uint16_t*)0x200005e8 = 0; *(uint32_t*)0x200005ec = 0; *(uint32_t*)0x200005f0 = 0; *(uint64_t*)0x200005f8 = 2; *(uint16_t*)0x20000600 = 0; *(uint32_t*)0x20000604 = 0; *(uint32_t*)0x20000608 = 0; *(uint64_t*)0x20000610 = 0; *(uint16_t*)0x20000618 = 0; *(uint32_t*)0x2000061c = 0x20000; *(uint32_t*)0x20000620 = 0; *(uint64_t*)0x20000628 = 0; *(uint16_t*)0x20000630 = 0; *(uint32_t*)0x20000634 = 0; *(uint32_t*)0x20000638 = 0; *(uint64_t*)0x20000640 = 0; *(uint16_t*)0x20000648 = 0; *(uint32_t*)0x2000064c = 0; *(uint32_t*)0x20000650 = 0; *(uint64_t*)0x20000658 = 0; *(uint16_t*)0x20000660 = 0; *(uint32_t*)0x20000664 = 0; *(uint32_t*)0x20000668 = 0; *(uint64_t*)0x20000670 = 0; *(uint16_t*)0x20000678 = 0; *(uint32_t*)0x2000067c = 0; *(uint32_t*)0x20000680 = 0; *(uint64_t*)0x20000688 = 0; *(uint16_t*)0x20000690 = 0; *(uint32_t*)0x20000694 = 0; *(uint32_t*)0x20000698 = 0; *(uint64_t*)0x200006a0 = 0; *(uint16_t*)0x200006a8 = 0; *(uint32_t*)0x200006ac = 0; *(uint32_t*)0x200006b0 = 0; *(uint64_t*)0x200006b8 = 0; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(ioctl))(/*fd=*/r[2], /*cmd=*/0x82405605, /*arg=*/0x20000480); memcpy((void*)0x20000200, "/dev/vmm\000", 9); res = -1; res = ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t))CAST(openat))(/*fd=*/0xffffffffffffff9c, /*file=*/0x20000200, /*flags=O_RDWR*/2, /*mode=*/0); if (res != -1) r[3] = res; *(uint32_t*)0x200004c0 = 3; *(uint32_t*)0x200004c4 = 0; *(uint8_t*)0x200004c8 = 9; *(uint16_t*)0x200004ca = 0x3f; *(uint64_t*)0x200004d0 = 0x20000240; *(uint8_t*)0x20000240 = 7; *(uint8_t*)0x20000241 = 3; *(uint8_t*)0x20000242 = 9; *(uint8_t*)0x20000243 = 2; *(uint8_t*)0x20000244 = 8; *(uint16_t*)0x20000246 = 0x80; *(uint32_t*)0x20000248 = 1; *(uint64_t*)0x20000250 = 0xfc; *(uint64_t*)0x20000258 = 5; *(uint64_t*)0x20000260 = 1; *(uint64_t*)0x20000268 = 0x5f7; *(uint64_t*)0x20000270 = 0xbb2f; *(uint64_t*)0x20000278 = 5; *(uint64_t*)0x20000280 = 9; *(uint64_t*)0x20000288 = 2; *(uint64_t*)0x20000290 = 0x13a; *(uint64_t*)0x20000298 = 2; *(uint64_t*)0x200002a0 = 0x50; *(uint64_t*)0x200002a8 = 0x8000000000000000; *(uint64_t*)0x200002b0 = 0x80000000; *(uint64_t*)0x200002b8 = 0x7f; *(uint64_t*)0x200002c0 = 0x40; *(uint64_t*)0x200002c8 = 0; *(uint64_t*)0x200002d0 = 4; *(uint64_t*)0x200002d8 = 0xbb1; *(uint64_t*)0x200002e0 = 5; *(uint64_t*)0x200002e8 = 0x1000000000000000; *(uint64_t*)0x200002f0 = 1; *(uint64_t*)0x200002f8 = 3; *(uint64_t*)0x20000300 = 0; *(uint64_t*)0x20000308 = 0x821; *(uint64_t*)0x20000310 = 0; *(uint64_t*)0x20000318 = 4; *(uint64_t*)0x20000320 = 9; *(uint64_t*)0x20000328 = 0xc2; *(uint64_t*)0x20000330 = 9; *(uint64_t*)0x20000338 = 1; *(uint64_t*)0x20000340 = 0x1000; *(uint64_t*)0x20000348 = 0x2b98; *(uint64_t*)0x20000350 = 0xeab; *(uint64_t*)0x20000358 = 0xfa19; *(uint64_t*)0x20000360 = 0x3ff; *(uint64_t*)0x20000368 = 0x7fffffff; *(uint64_t*)0x20000370 = 4; *(uint64_t*)0x20000378 = 0xfffffffffffffffd; *(uint64_t*)0x20000380 = 8; *(uint64_t*)0x20000388 = 1; *(uint64_t*)0x20000390 = 0x1ff; *(uint16_t*)0x20000398 = 0x40; *(uint32_t*)0x2000039c = 1; *(uint32_t*)0x200003a0 = 7; *(uint64_t*)0x200003a8 = 4; *(uint16_t*)0x200003b0 = 1; *(uint32_t*)0x200003b4 = 7; *(uint32_t*)0x200003b8 = 0x5050; *(uint64_t*)0x200003c0 = 1; *(uint16_t*)0x200003c8 = 0x3ff; *(uint32_t*)0x200003cc = 0x98b; *(uint32_t*)0x200003d0 = 0; *(uint64_t*)0x200003d8 = 0; *(uint16_t*)0x200003e0 = 7; *(uint32_t*)0x200003e4 = 0x8000; *(uint32_t*)0x200003e8 = 0x432; *(uint64_t*)0x200003f0 = 0; *(uint16_t*)0x200003f8 = 0xe42; *(uint32_t*)0x200003fc = 0x74; *(uint32_t*)0x20000400 = 0xb39c; *(uint64_t*)0x20000408 = 0xa4; *(uint16_t*)0x20000410 = 7; *(uint32_t*)0x20000414 = 0xba; *(uint32_t*)0x20000418 = 4; *(uint64_t*)0x20000420 = 9; *(uint16_t*)0x20000428 = 0xfa1; *(uint32_t*)0x2000042c = 3; *(uint32_t*)0x20000430 = 1; *(uint64_t*)0x20000438 = 3; *(uint16_t*)0x20000440 = 5; *(uint32_t*)0x20000444 = 0x7ff; *(uint32_t*)0x20000448 = -1; *(uint64_t*)0x20000450 = 0x400; *(uint16_t*)0x20000458 = 0; *(uint32_t*)0x2000045c = 3; *(uint32_t*)0x20000460 = 0; *(uint64_t*)0x20000468 = 0xffffffffffff0b3b; *(uint16_t*)0x20000470 = 4; *(uint32_t*)0x20000474 = 0x10000; *(uint32_t*)0x20000478 = 9; *(uint64_t*)0x20000480 = 8; *(uint16_t*)0x200004d8 = 0xfa13; *(uint8_t*)0x200004da = 1; ((intptr_t(*)(intptr_t,intptr_t,intptr_t))CAST(ioctl))(/*fd=*/r[3], /*cmd=*/0xc0205602, /*arg=*/0x200004c0); } int main(void) { ((intptr_t(*)(intptr_t,intptr_t,intptr_t,intptr_t,intptr_t,intptr_t))CAST(mmap))(/*addr=*/0x20000000, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ*/3, /*flags=MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE*/0x1012, /*fd=*/-1, /*offset=*/0); loop(); return 0; }