// https://syzkaller.appspot.com/bug?id=8220a8f376ad410bb013c26c6b28f8c03bebb936 // 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_mount #define __NR_mount 40 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_sched_setscheduler #define __NR_sched_setscheduler 119 #endif #ifndef __NR_write #define __NR_write 64 #endif uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-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=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // sched_setscheduler arguments: [ // pid: pid (resource) // policy: sched_policy = 0x2 (8 bytes) // prio: ptr[in, int32] { // int32 = 0x3 (4 bytes) // } // ] *(uint32_t*)0x20000640 = 3; syscall(__NR_sched_setscheduler, /*pid=*/0, /*policy=SCHED_RR*/ 2ul, /*prio=*/0x20000640ul); // mount$fuse arguments: [ // src: const = 0x0 (8 bytes) // dst: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // type: ptr[in, buffer] { // buffer: {66 75 73 65 00} (length 0x5) // } // flags: mount_flags = 0x0 (8 bytes) // opts: nil // ] memcpy((void*)0x20000140, "./file0\000", 8); memcpy((void*)0x200000c0, "fuse\000", 5); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x20000140ul, /*type=*/0x200000c0ul, /*flags=*/0ul, /*opts=*/0ul); // openat$cgroup_ro arguments: [ // fd: fd_cgroup (resource) // file: ptr[in, buffer] { // buffer: {63 70 75 2e 73 74 61 74 00} (length 0x9) // } // flags: const = 0x275a (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd memcpy((void*)0x20000080, "cpu.stat\000", 9); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000080ul, /*flags=*/0x275a, /*mode=*/0); if (res != -1) r[0] = res; // write$UHID_CREATE2 arguments: [ // fd: fd_uhid (resource) // data: nil // len: len = 0x118 (8 bytes) // ] syscall(__NR_write, /*fd=*/r[0], /*data=*/0ul, /*len=*/0x118ul); // ioctl$BTRFS_IOC_SEND arguments: [ // fd: fd (resource) // cmd: const = 0xd0009411 (4 bytes) // arg: nil // ] syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0xd0009411, /*arg=*/0ul); return 0; }