// https://syzkaller.appspot.com/bug?id=e6d1ed219bd92dd9b3e653eda032852996a9b457 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include static uintptr_t syz_open_procfs(uintptr_t a0, uintptr_t a1) { char buf[128]; memset(buf, 0, sizeof(buf)); if (a0 == 0) { snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1); } else if (a0 == (uintptr_t)-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; } static void execute_one(); extern unsigned long long procid; void loop() { while (1) { execute_one(); } } void execute_one() { syscall(__NR_sysinfo, 0x200014c0); memcpy((void*)0x20000140, "./file0", 8); syscall(__NR_open, 0x20000140, 0xa002, 0x20); syscall(__NR_mmap, 0x20000000, 0x7fffdffff000, 0, 0x31, -1, 0); syscall(__NR_socketpair, 8, 2, 0xb1, 0x20000000); syscall(__NR_epoll_create, 4); syscall(__NR_epoll_create1, 0x80000); memcpy((void*)0x20001c40, "/dev/full", 10); syscall(__NR_openat, 0xffffffffffffff9c, 0x20001c40, 1, 0); memcpy((void*)0x20001d40, "ns/net", 7); syz_open_procfs(0, 0x20001d40); memcpy((void*)0x20001ec0, "./file0", 8); syscall(__NR_openat, 0xffffffffffffff9c, 0x20001ec0, 0x4000, 0x102); memcpy((void*)0x200002c0, "user", 5); *(uint8_t*)0x20000300 = 0x73; *(uint8_t*)0x20000301 = 0x79; *(uint8_t*)0x20000302 = 0x7a; *(uint8_t*)0x20000303 = 0x23; *(uint8_t*)0x20000304 = 0; syscall(__NR_add_key, 0x200002c0, 0x20000300, 0x20000340, 0, 0xfffffffa); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); for (;;) { loop(); } }