// https://syzkaller.appspot.com/bug?id=2a8ea4797595393d3e237d9e8d49ead18997953a // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include 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; } #ifndef __NR_accept4 #define __NR_accept4 364 #endif #ifndef __NR_bind #define __NR_bind 361 #endif #ifndef __NR_mmap #define __NR_mmap 192 #endif #ifndef __NR_sendfile #define __NR_sendfile 187 #endif #ifndef __NR_socket #define __NR_socket 359 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x1ffff000, 0x1000, 0, 0x32, -1, 0); syscall(__NR_mmap, 0x20000000, 0x1000000, 7, 0x32, -1, 0); syscall(__NR_mmap, 0x21000000, 0x1000, 0, 0x32, -1, 0); intptr_t res = 0; res = syscall(__NR_socket, 0x26, 5, 0); if (res != -1) r[0] = res; *(uint16_t*)0x20001840 = 0x26; memcpy((void*)0x20001842, "hash\000\000\000\000\000\000\000\000\000\000", 14); *(uint32_t*)0x20001850 = 0; *(uint32_t*)0x20001854 = 0; memcpy((void*)0x20001858, "crc32\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\000\000", 64); syscall(__NR_bind, (intptr_t)r[0], 0x20001840, 0x58); res = syscall(__NR_accept4, (intptr_t)r[0], 0, 0, 0); if (res != -1) r[1] = res; res = syscall(__NR_accept4, (intptr_t)r[1], 0, 0, 0); if (res != -1) r[2] = res; memcpy((void*)0x20000100, "net/dev\000", 8); res = -1; res = syz_open_procfs(0, 0x20000100); if (res != -1) r[3] = res; syscall(__NR_sendfile, (intptr_t)r[2], (intptr_t)r[3], 0, 0x900); return 0; }