// https://syzkaller.appspot.com/bug?id=a133db4b32d89957481e21b5080f9edfa3bf4359 // 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_dev(volatile long a0, volatile long a1, volatile long 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) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; memcpy((void*)0x20000000, "./bus\000", 6); res = syscall(__NR_creat, 0x20000000, 0); if (res != -1) r[0] = res; memcpy((void*)0x200000c0, "./bus\000", 6); memcpy((void*)0x20000100, "9p\000", 3); memcpy((void*)0x20000240, "trans=fd,", 9); memcpy((void*)0x20000249, "rfdno", 5); *(uint8_t*)0x2000024e = 0x3d; sprintf((char*)0x2000024f, "0x%016llx", (long long)r[0]); *(uint8_t*)0x20000261 = 0x2c; memcpy((void*)0x20000262, "wfdno", 5); *(uint8_t*)0x20000267 = 0x3d; sprintf((char*)0x20000268, "0x%016llx", (long long)r[0]); *(uint8_t*)0x2000027a = 0x2c; memcpy((void*)0x2000027b, "access=client", 13); *(uint8_t*)0x20000288 = 0x2c; memcpy((void*)0x20000289, "cachetag", 8); *(uint8_t*)0x20000291 = 0x3d; *(uint8_t*)0x20000292 = 0x2c; memcpy((void*)0x20000293, "mmap", 4); *(uint8_t*)0x20000297 = 0x2c; memcpy((void*)0x20000298, "access=any", 10); *(uint8_t*)0x200002a2 = 0x2c; memcpy((void*)0x200002a3, "access=user", 11); *(uint8_t*)0x200002ae = 0x2c; memcpy((void*)0x200002af, "obj_type", 8); *(uint8_t*)0x200002b7 = 0x3d; memcpy((void*)0x200002b8, "-&", 2); *(uint8_t*)0x200002ba = 0x2c; memcpy((void*)0x200002bb, "obj_type", 8); *(uint8_t*)0x200002c3 = 0x3d; *(uint8_t*)0x200002c4 = 0x2c; memcpy((void*)0x200002c5, "context", 7); *(uint8_t*)0x200002cc = 0x3d; memcpy((void*)0x200002cd, "staff_u", 7); *(uint8_t*)0x200002d4 = 0x2c; memcpy((void*)0x200002d5, "obj_role", 8); *(uint8_t*)0x200002dd = 0x3d; memcpy((void*)0x200002de, "cpuset-security&,*", 18); *(uint8_t*)0x200002f0 = 0x2c; memcpy((void*)0x200002f1, "measure", 7); *(uint8_t*)0x200002f8 = 0x2c; memcpy((void*)0x200002f9, "fscontext", 9); *(uint8_t*)0x20000302 = 0x3d; memcpy((void*)0x20000303, "root", 4); *(uint8_t*)0x20000307 = 0x2c; *(uint8_t*)0x20000308 = 0; syscall(__NR_mount, 0, 0x200000c0, 0x20000100, 8, 0x20000240); syscall(__NR_mmap, 0x20ffb000, 0x4000, 0, 0x1012, -1, 0); syz_open_dev(0, 0, 0x1000000200000581); syscall(__NR_socket, 2, 6, 0); syscall(__NR_sendmsg, -1, 0, 0x840); syscall(__NR_setsockopt, -1, 0x84, 0x23, 0, 0); syscall(__NR_getsockopt, -1, 0x84, 0x18, 0, 0); syscall(__NR_ioctl, -1, 0xab02, 4); memcpy((void*)0x20000080, "/selinux/user\000", 14); syscall(__NR_openat, 0xffffffffffffff9c, 0x20000080, 2, 0); return 0; }