// https://syzkaller.appspot.com/bug?id=4f5b71612ca24f1c814f1413a8022656c4cae691 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include __attribute__((noreturn)) static void doexit(int status) { volatile unsigned i; syscall(__NR_exit_group, status); for (i = 0;; i++) { } } #include #include const int kFailStatus = 67; const int kRetryStatus = 69; static void fail(const char* msg, ...) { int e = errno; va_list args; va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); fprintf(stderr, " (errno %d)\n", e); doexit((e == ENOMEM || e == EAGAIN) ? kRetryStatus : kFailStatus); } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); #define CLONE_NEWCGROUP 0x02000000 unshare(CLONE_NEWNS); unshare(CLONE_NEWIPC); unshare(CLONE_NEWCGROUP); unshare(CLONE_NEWNET); unshare(CLONE_NEWUTS); unshare(CLONE_SYSVSEM); } static int do_sandbox_none(int executor_pid, bool enable_tun) { unshare(CLONE_NEWPID); int pid = fork(); if (pid < 0) fail("sandbox fork failed"); if (pid) return pid; sandbox_common(); loop(); doexit(1); } long r[2]; void loop() { memset(r, -1, sizeof(r)); syscall(__NR_mmap, 0x20000000, 0xfff000, 3, 0x32, -1, 0); r[0] = syscall(__NR_socket, 0xa, 1, 0); *(uint64_t*)0x20000000 = 0; *(uint64_t*)0x20000008 = 0x2000000000; *(uint32_t*)0x20000010 = 0; *(uint32_t*)0x20000014 = 3; *(uint32_t*)0x20000018 = 1; *(uint64_t*)0x20000020 = 4; *(uint64_t*)0x20000028 = 0; *(uint64_t*)0x20000030 = 0; *(uint64_t*)0x20000038 = 0; *(uint64_t*)0x20000040 = 0; *(uint32_t*)0x20000048 = 0; *(uint32_t*)0x2000004c = 0; *(uint32_t*)0x20000050 = 0; *(uint32_t*)0x20000054 = 0; syscall(__NR_ioctl, -1, 0xc020660b, 0x20000000); syscall(__NR_ioctl, r[0], 0x8918, 0x20000000); r[1] = syscall(__NR_socket, 0x11, 3, 0); memcpy((void*)0x20155000, "\x20\x40\x01\x6f", 4); syscall(__NR_setsockopt, r[1], 0x107, 0xf, 0x20155000, 4); *(uint64_t*)0x209bffab = 0x202b0000; *(uint32_t*)0x209bffb3 = 0x60; *(uint64_t*)0x209bffbb = 0x20886fe0; *(uint64_t*)0x209bffc3 = 2; *(uint64_t*)0x209bffcb = 0x208adf10; *(uint64_t*)0x209bffd3 = 0x10; *(uint32_t*)0x209bffdb = 0; *(uint16_t*)0x202b0000 = 0x27; *(uint32_t*)0x202b0004 = 4; *(uint32_t*)0x202b0008 = 0; *(uint32_t*)0x202b000c = 0; *(uint8_t*)0x202b0010 = 0; *(uint8_t*)0x202b0011 = 0; memcpy((void*)0x202b0012, "\xa2\x84\x02\x7e\x94\x77\x5b\xb0\xa6\x1c\x0a\x37\xf9\x8a\x86\xd1\x53" "\x9b\xce\xf0\x5a\x11\x31\x1b\x56\xeb\x8e\x51\x3a\xfa\x21\x84\x79\xb8" "\xc5\x41\x21\x27\x6c\x0a\x00\x67\x15\xb1\xdd\x24\xab\x77\xa3\x9e\xd8" "\xc2\xa4\xda\x5a\xb8\x2a\xfb\x82\x03\x30\xe4\xfe", 63); *(uint64_t*)0x202b0058 = 4; *(uint64_t*)0x20886fe0 = 0x20ee7f29; *(uint64_t*)0x20886fe8 = 0xd7; *(uint64_t*)0x20886ff0 = 0x2050cf58; *(uint64_t*)0x20886ff8 = 0; memcpy((void*)0x20ee7f29, "\x06\x00\x00\x00\xac\xd8\xd2\xa9\xdb\x76\xdd\x0e\xe4\x02\xac\x94\xa2" "\xc0\x23\x07\xd7\xba\x52\x66\x4d\xaa\xdd\xcd\x66\xb0\x76\x5b\x4c\x31" "\xdd\x36\x7e\x8b\xb4\x50\x81\x9c\x5d\x65\xdb\x8f\x69\xfe\xbe\x99\xf8" "\x73\x82\xd7\x7e\xbe\x61\x19\x0f\x6d\xd7\x2c\x71\xf1\x1c\x7b\x86\xa0" "\xc8\x4d\x45\xa5\x6b\x35\x44\xba\xa5\xef\x88\x2e\x7f\x71\x25\x34\xc1" "\xe7\xe1\x8c\x83\x94\xdb\x6f\xe9\x39\x82\xfd\x04\xff\xed\x6c\x86\x00" "\x52\xba\x88\x64\x82\x8a\x38\x15\x60\x29\xce\x3a\x13\x0b\x93\x49\x0e" "\x0b\x48\x48\xf7\x04\x5a\x9e\x0c\x14\x1f\x54\xf1\x58\xb9\x7a\xca\x9a" "\x5b\x7b\xc2\x6a\x1b\x22\xae\xeb\x04\x89\x98\xd4\x17\xc4\x82\x8b\x00" "\xcf\xf9\xfb\x0b\xf7\x4f\x6d\x74\xf4\x85\xfb\x40\x40\x40\x13\x44\xab" "\x9c\x9a\x1e\x4b\xda\x65\x20\x64\x09\x79\x11\x5e\x45\x0b\x66\x7f\x20" "\xd9\xf6\x5c\x7a\xe8\xb2\x8c\xf1\xa7\x63\x74\x41\xa5\xb8\xfd\x5d\x0b" "\x54\x74\x9f\x84\xce\x4d\xbf\x1f\x24\x6a\xca", 215); *(uint64_t*)0x208adf10 = 0x10; *(uint32_t*)0x208adf18 = 0; *(uint32_t*)0x208adf1c = 0; syscall(__NR_sendmmsg, r[1], 0x209bffab, 1, 0); } int main() { int pid = do_sandbox_none(0, false); int status = 0; while (waitpid(pid, &status, __WALL) != pid) { } return 0; }