// https://syzkaller.appspot.com/bug?id=34609cfe6372880778d0c8d170ba5dc2ffd99741 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*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=*/0x200001000000ul, /*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)) { } // openat$ttyprintk arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 74 74 79 70 72 69 6e 74 6b 00} (length 0xf) // } // flags: open_flags = 0x21041 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_tty memcpy((void*)0x200000000040, "/dev/ttyprintk\000", 15); res = syscall( __NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000040ul, /*flags=O_NOFOLLOW|O_CREAT|O_WRONLY|0x1000*/ 0x21041, /*mode=*/0); if (res != -1) r[0] = res; // ioctl$TIOCSETD arguments: [ // fd: fd_tty (resource) // cmd: const = 0x5423 (4 bytes) // arg: ptr[in, int32] { // int32 = 0x15 (4 bytes) // } // ] *(uint32_t*)0x2000000000c0 = 0x15; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x5423, /*arg=*/0x2000000000c0ul); // writev arguments: [ // fd: fd (resource) // vec: ptr[in, array[iovec[in, array[int8]]]] { // array[iovec[in, array[int8]]] { // iovec[in, array[int8]] { // addr: ptr[in, buffer] { // buffer: {f8} (length 0x1) // } // len: len = 0x1 (8 bytes) // } // } // } // vlen: len = 0x1 (8 bytes) // ] *(uint64_t*)0x200000000340 = 0x200000000100; memset((void*)0x200000000100, 248, 1); *(uint64_t*)0x200000000348 = 1; syscall(__NR_writev, /*fd=*/r[0], /*vec=*/0x200000000340ul, /*vlen=*/1ul); return 0; }