// https://syzkaller.appspot.com/bug?id=4006bcda50967d109d7512134751ca8fb84d393f // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #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); } } static void test(); void loop() { while (1) { test(); } } #ifndef __NR_mmap #define __NR_mmap 192 #endif #ifndef __NR_ioctl #define __NR_ioctl 54 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 356 #endif #undef __NR_mmap #define __NR_mmap __NR_mmap2 long r[20]; void test() { memset(r, -1, sizeof(r)); r[0] = syscall(__NR_mmap, 0x20000000ul, 0xfff000ul, 0x3ul, 0x32ul, 0xfffffffffffffffful, 0x0ul); memcpy((void*)0x202a0000, "\x2f\x64\x65\x76\x2f\x6c\x6f\x6f\x70\x23\x00", 11); r[2] = syz_open_dev(0x202a0000ul, 0x0ul, 0x0ul); *(uint32_t*)0x2053ff74 = (uint32_t)0x0; *(uint32_t*)0x2053ff78 = (uint32_t)0x0; *(uint32_t*)0x2053ff7c = (uint32_t)0x0; *(uint32_t*)0x2053ff80 = (uint32_t)0x0; *(uint32_t*)0x2053ff84 = (uint32_t)0x80; *(uint32_t*)0x2053ff88 = (uint32_t)0x0; *(uint32_t*)0x2053ff8c = (uint32_t)0x16; *(uint32_t*)0x2053ff90 = (uint32_t)0x9; memcpy((void*)0x2053ff94, "\xb8\x85\xfc\x0c\x97\xf0\xaa\x14\x11\xf4\x81\xfd\xf3\xa9\xde" "\xe8\x4c\x1a\x3b\x42\xb8\xd7\xfb\x46\xa2\x6a\x7d\x2e\x87\x9c" "\xff\xca\x0c\xeb\x90\xd3\xe4\xe5\x80\xbe\x13\xb9\x80\xb0\x91" "\xf1\x41\xec\xfb\x95\x90\xe8\x82\x44\xf8\xc3\x14\x7f\x06\x7b" "\xb1\xf2\x8c\x28", 64); memcpy((void*)0x2053ffd4, "\x8b\x5d\x39\xcb\xd9\x51\xbf\xdc\xb2\xdd" "\x2b\x0a\x38\xfe\x9a\xb8\x81\x42\x4f\x09" "\xc1\x3f\x8b\x51\x55\x45\x91\x33\x27\x35" "\x37\x8a", 32); *(uint32_t*)0x2053fff4 = (uint32_t)0x3; *(uint32_t*)0x2053fff8 = (uint32_t)0x5; *(uint32_t*)0x2053fffc = (uint32_t)0x0; r[16] = syscall(__NR_ioctl, r[2], 0x4c02ul, 0x2053ff74ul); memcpy((void*)0x20000000, "\xff\xf8", 2); r[18] = syscall(__NR_memfd_create, 0x20000000ul, 0x0ul); r[19] = syscall(__NR_ioctl, r[2], 0x4c00ul, r[18]); } int main() { loop(); return 0; }