// https://syzkaller.appspot.com/bug?id=4b623f46ef7212d2d4777fe94a13f6722ff3c4c1 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #ifndef __NR_ioctl #define __NR_ioctl 29 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif 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; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x20000080, "/dev/loop-control\000", 18); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[0] = res; syscall( __NR_ioctl, /*fd=*/r[0], /*cmd=*/0x4c80, /*arg=BTRFS_BALANCE_CTL_PAUSE|0xb0275faa5ab88744*/ 0xb0275faa5ab88745ul); memcpy((void*)0x20000080, "/dev/loop-control\000", 18); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul, /*flags=*/0ul, /*mode=*/0ul); if (res != -1) r[1] = res; syscall( __NR_ioctl, /*fd=*/r[1], /*cmd=*/0x4c81, /*arg=BTRFS_BALANCE_CTL_PAUSE|0xb0275faa5ab88744*/ 0xb0275faa5ab88745ul); return 0; }