mmap a hostile file, then a truncating writer on another handle. You will have a bad day. I read() into a cap now.
There is not a story where mmap is the right call for untrusted input. mmap is for your own files.
Refs: ELF
Lab / educational. Public binaries and patched classes only. Isolated VM.