// https://syzkaller.appspot.com/bug?id=dd83831558d2e5a20c759bb6355feac293219e22 // 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[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); intptr_t res = 0; res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=*/1ul, /*proto=*/0, /*fds=*/0x20000000ul); if (res != -1) { r[0] = *(uint32_t*)0x20000000; r[1] = *(uint32_t*)0x20000004; } syscall(__NR_fcntl, /*fd=*/r[0], /*cmd=*/8ul, /*pid=*/-1); *(uint64_t*)0x200001c0 = 0; *(uint32_t*)0x200001c8 = 0; *(uint64_t*)0x200001d0 = 0x20000240; *(uint64_t*)0x20000240 = 0x20000080; memset((void*)0x20000080, 60, 1); *(uint64_t*)0x20000248 = 1; *(uint64_t*)0x200001d8 = 1; *(uint64_t*)0x200001e0 = 0; *(uint64_t*)0x200001e8 = 0; *(uint32_t*)0x200001f0 = 0; syscall( __NR_sendmsg, /*fd=*/r[1], /*msg=*/0x200001c0ul, /*f=MSG_ZEROCOPY|MSG_FASTOPEN|MSG_BATCH|MSG_PROBE|MSG_OOB|MSG_NOSIGNAL|MSG_DONTROUTE*/ 0x24044015ul); *(uint16_t*)0x20001080 = 0; *(uint16_t*)0x20001082 = 0; *(uint16_t*)0x20001084 = 0; *(uint16_t*)0x20001086 = 0; *(uint16_t*)0x20001088 = 1; *(uint16_t*)0x2000108a = 0x4d; *(uint16_t*)0x2000108c = 2; *(uint16_t*)0x20001090 = 0; *(uint16_t*)0x20001092 = 0; *(uint16_t*)0x20001094 = 0; *(uint16_t*)0x20001096 = 0; *(uint16_t*)0x20001098 = 0; *(uint16_t*)0x2000109a = 0; *(uint16_t*)0x2000109c = 0; *(uint16_t*)0x2000109e = 0; *(uint16_t*)0x200010a0 = 0; *(uint32_t*)0x200010a4 = 0; *(uint64_t*)0x200010a8 = 0; syscall(__NR_ioctl, /*fd=*/-1, /*cmd=*/0x40304580, /*arg=*/0x20001080ul); memcpy((void*)0x200000c0, "/dev/input/event#\000", 18); res = -1; res = syz_open_dev(/*dev=*/0x200000c0, /*id=*/2, /*flags=*/0); if (res != -1) r[2] = res; *(uint64_t*)0x20000000 = 0x7ff; syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=FIOASYNC*/ 0x5452, /*v=*/0x20000000ul); memcpy((void*)0x200000c0, "/dev/input/event#\000", 18); res = -1; res = syz_open_dev( /*dev=*/0x200000c0, /*id=*/2, /*flags=O_TRUNC|O_NONBLOCK|O_NOFOLLOW|O_NOCTTY|FASYNC|O_WRONLY|0x800000*/ 0x822b01); if (res != -1) r[3] = res; memset((void*)0x20000040, 226, 1); syscall(__NR_write, /*fd=*/r[3], /*buf=*/0x20000040ul, /*count=*/0x2778ul); return 0; }