// https://syzkaller.appspot.com/bug?id=8e030beda49b8e549cfeb17ed369414ed27331e6 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #ifndef __NR_bpf #define __NR_bpf 321 #endif static long syz_open_procfs(volatile long a0, volatile long a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == -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; } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); const char* reason; (void)reason; intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy( (void*)0x200001c0, "\x5d\xa1\xe6\xae\x46\xb5\xa4\x18\x29\xa4\xf3\x8e\x47\xc7\xb4\xd4\x66\xe5" "\x37\xe8\xe2\x83\xc3\x46\xa4\x56\xbc\xd2\xbd\x65\x3a\x97\x29\x55\x45\x8f" "\x5d\x50\x0a\xa6\x00\x00\xb4\x25\x44\xdf\xc9\x14\x2b\xd0\x2d\xbc\xec\xe4" "\x10\x1f\xa9\x34\xf9\xeb\xac\xb0\x33\xce\x03\x22\xc5\xa6\x45\x94\x6d", 71); syscall( __NR_sendto, /*fd=*/-1, /*buf=*/0x200001c0ul, /*len=*/0x47ul, /*f=MSG_FASTOPEN|MSG_BATCH|MSG_OOB|MSG_MORE|MSG_DONTROUTE*/ 0x20048005ul, /*addr=*/0ul, /*addrlen=*/0ul); *(uint32_t*)0x200000c0 = 0x1f; *(uint32_t*)0x200000c4 = 0; *(uint32_t*)0x200000c8 = 0; *(uint32_t*)0x200000cc = 0x1000; *(uint32_t*)0x200000d0 = 0; *(uint32_t*)0x200000d4 = 1; *(uint32_t*)0x200000d8 = 0; memset((void*)0x200000dc, 0, 16); *(uint32_t*)0x200000ec = 0; *(uint32_t*)0x200000f0 = -1; *(uint32_t*)0x200000f4 = 0; *(uint32_t*)0x200000f8 = 0; *(uint32_t*)0x200000fc = 0; *(uint64_t*)0x20000100 = 0; *(uint32_t*)0x20000108 = 0; *(uint32_t*)0x2000010c = 0; res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x200000c0ul, /*size=*/0x48ul); if (res != -1) r[0] = res; syscall(__NR_mmap, /*addr=*/0x20ffd000ul, /*len=*/0x3000ul, /*prot=PROT_GROWSDOWN|PROT_SEM|PROT_WRITE|PROT_READ|PROT_EXEC*/ 0x100000ful, /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul, /*fd=*/r[0], /*offset=*/0x1000ul); memcpy((void*)0x200001c0, "maps\000", 5); res = -1; res = syz_open_procfs(/*pid=*/0, /*file=*/0x200001c0); if (res != -1) r[1] = res; *(uint32_t*)0x20000180 = 0x68; *(uint32_t*)0x20000184 = 0; *(uint64_t*)0x20000188 = 0x3f; *(uint64_t*)0x20000190 = 0x2000; *(uint64_t*)0x20000198 = 0x20ffe000; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0xc0686611, /*arg=*/0x20000180ul); return 0; }