// https://syzkaller.appspot.com/bug?id=14ea6e604fd236dc221634f0cb7c7bd4504e21f1 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #ifndef __NR_madvise #define __NR_madvise 233 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif #ifndef __NR_seccomp #define __NR_seccomp 277 #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)) { } memcpy((void*)0x200000c0, "/dev/zero\000", 10); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000c0ul, /*flags=O_CLOEXEC|O_RDWR*/ 0x80002, /*mode=*/0); if (res != -1) r[0] = res; syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x200000ul, /*prot=PROT_GROWSDOWN|PROT_SEM|PROT_WRITE|PROT_EXEC*/ 0x100000eul, /*flags=MAP_FIXED|MAP_PRIVATE*/ 0x12ul, /*fd=*/r[0], /*offset=*/0x343e2000ul); *(uint16_t*)0x20000240 = 0; *(uint64_t*)0x20000248 = 0; syscall(__NR_seccomp, /*op=*/1ul, /*flags=*/7ul, /*arg=*/0x20000240ul); syscall(__NR_madvise, /*addr=*/0x20000000ul, /*len=*/0xc00000ul, /*advice=MADV_COLLAPSE*/ 0x19ul); return 0; }