// https://syzkaller.appspot.com/bug?id=d0d8879a66b36bd60a0d815b7755e558a9afc82f // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) uint64_t r[2] = {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; memcpy((void*)0x200018c0, "/dev/snd/seq\000", 13); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200018c0ul, /*flags=O_NONBLOCK|O_NOFOLLOW|O_NOATIME|O_EXCL|O_CLOEXEC|0x401*/ 0xe0c81ul, 0); if (res != -1) r[0] = res; *(uint32_t*)0x200008c0 = 0; *(uint32_t*)0x200008c4 = 0; STORE_BY_BITMASK(uint32_t, , 0x200008c8, 0, 0, 1); memcpy((void*)0x200008c9, "queue0\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000", 64); *(uint32_t*)0x2000090c = 0; memset((void*)0x20000910, 0, 60); syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xc08c5332, /*arg=*/0x200008c0ul); memcpy((void*)0x20000000, "/dev/dsp\000", 9); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000000ul, /*flags=O_CREAT|O_RDWR*/ 0x42ul, /*mode=*/0ul); if (res != -1) r[1] = res; memset((void*)0x20000280, 240, 1); syscall(__NR_write, /*fd=*/r[1], /*data=*/0x20000280ul, /*len=*/1ul); return 0; }