// https://syzkaller.appspot.com/bug?id=81a8305cd101438de3770cd5fb625389bc9a4df9 // 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_dev(uintptr_t a0, uintptr_t a1, uintptr_t a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf)); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } #ifndef __NR_mmap #define __NR_mmap 192 #endif #ifndef __NR_socket #define __NR_socket 359 #endif #ifndef __NR_fcntl #define __NR_fcntl 55 #endif #ifndef __NR_ioctl #define __NR_ioctl 54 #endif #ifndef __NR_read #define __NR_read 3 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 long r[3]; void loop() { memset(r, -1, sizeof(r)); syscall(__NR_mmap, 0x20001000, 0xffe000, 3, 0x32, -1, 0); r[0] = syscall(__NR_socket, 2, 1, 0); memcpy((void*)0x2051fff3, "/dev/net/tun", 13); r[1] = syz_open_dev(0x2051fff3, 0, 0); r[2] = syscall(__NR_fcntl, r[1], 0, r[1]); memcpy((void*)0x20a84000, "\x67\x72\x65\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); memcpy((void*)0x20a84010, "\xca\x4f\x73\x4f\x7f\x35\x52\x6c\xe9\x0e\x00\x00\xff\xff\xee\x00", 16); syscall(__NR_ioctl, r[2], 0x400454ca, 0x20a84000); memcpy((void*)0x2062ffe0, "\x67\x72\x65\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); *(uint16_t*)0x2062fff0 = 0x301; syscall(__NR_ioctl, r[0], 0x8914, 0x2062ffe0); syscall(__NR_read, r[1], 0x20838000, 0xe); } int main() { loop(); return 0; }