Re:TinyKVM: Fast sandbox that runs on top of Varnish
by fwsgonzo on Friday March 14, 2025 @06:57AM
(#43361373)
There's many ways to go about it, but essentially yes, brk and mmap and a few others just to get into main() for some common run-times.
But you can do whatever you want. For example in libriscv I override the global allocator in my guest programs to use a host-managed heap. That way heap usage has native performance in interpreter mode, while also allowing me full control of the heap from the outside. I wrote about this here: https://medium.com/@fwsgonzo/using-c-as-a-scripting-language...
Re:TinyKVM: Fast sandbox that runs on top of Varnish
by cryptonector on Friday March 14, 2025 @11:57AM
(#43363886)
Well, yes, there's a few system calls like `brk()`/`sbrk()`/`getrandom()`, and what not. But you don't get to open any files or sockets or devices.
Re:TinyKVM: Fast sandbox that runs on top of Varnish
by fwsgonzo on Friday March 14, 2025 @12:42PM
(#43364384)
For the Varnish integration I added permission-based access to local files. Network stuff can be accessed through custom APIs. A simple fetch(url, options)-like system call. Just have a look at the VMOD repository. It's something I'd like to move into TinyKVM when I feel like it.
It’s a bit more than running a program under seccomp strict mode, but conceptually similar, so running anything too complicated likely won't work. You certainly won’t be able to sandbox chromium for taking website snapshots for example.