Readit News logoReadit News
trj commented on Show HN: Tiny VM sandbox in C with apps in Rust, C and Zig   github.com/ringtailsoftwa... · Posted by u/trj
rokoss21 · 3 months ago
Interesting timing - been looking for exactly this for embedded firmware testing. Most alternatives are either too heavy (full emulation) or too fragile (custom interpreters).

Have you considered adding support for memory-mapped IO simulation? That would make it useful for testing IoT/microcontroller drivers without the actual hardware.

trj · 3 months ago
This could be easily done. The emulator core supports memory mapped IO, but uvm32 only uses this to map an extra block of RAM from the host (for a framebuffer, or a separare memory heap). You can trap the writes here: https://github.com/ringtailsoftware/uvm32/blob/main/uvm32/uv... and the reads here https://github.com/ringtailsoftware/uvm32/blob/main/uvm32/uv...
trj commented on Show HN: Tiny VM sandbox in C with apps in Rust, C and Zig   github.com/ringtailsoftwa... · Posted by u/trj
apitman · 3 months ago
I did a brief comparison a while back, specifically WASM vs libriscv for. I decided to go with WASM, primarily because it was much more closely designed for this sort of thing, and it works in browsers. libriscv is really cool and impressive though.

EDIT: Found this link in my notes as well: https://news.ycombinator.com/item?id=24900376

trj · 3 months ago
libriscv looks amazing but its's much larger. It says "Less than 40kB total memory usage". My first version (unpublished) of uvm32 was called uvm80 and emulated a Zilog Z80 CPU. My aim is to have a safe, embeddable sandbox for any device, rather than the best performance.
trj commented on Show HN: Tiny VM sandbox in C with apps in Rust, C and Zig   github.com/ringtailsoftwa... · Posted by u/trj
IshKebab · 3 months ago
See https://opensource.googleblog.com/2025/11/secure-by-design-f...

This looks like it has a smaller code footprint at least. I'm not sure RISC-V is a very good target for this sort of thing. E.g. decoding the immediates in software is going to be very slow, whereas in hardware it's fast.

But on the other hand it is a stable target and can be configured to be a lot simpler than WASM.

trj · 3 months ago
Thanks for the link, Wasefire looks interesting. I suspect that their design goals are very different to mine. https://github.com/ringtailsoftware/uvm32?tab=readme-ov-file...
trj commented on Epsilon: A WASM virtual machine written in Go   github.com/ziggy42/epsilo... · Posted by u/ziggy42
simonw · 3 months ago
Do you have any plans to add timeouts or some other mechanism for limiting the amount of CPU a webassembly call can use?

I'm always interested in options for using WebAssembly as a sandbox to run untrusted code, but one of the things I need to protect against is an infinite loop.

(I had Claude knock up an experimental Python binding to try Epsilon out, notes from that here: https://github.com/simonw/research/tree/main/epsilon-python-... )

trj · 3 months ago
I'm working on an embeddable mini VM (RISC-V rather than WASM) and am considering this. In my model, there's something akin to a hardware watchdog where the VM is considered hung if it executes too many instructions without calling a yield() function in the host, then there's the ability to set a maximum number of instructions to execute before returning to the caller.

This lets it be handled asynchronously at the pace the host code chooses https://github.com/ringtailsoftware/uvm32

trj commented on A short primer on the SSH protocol   github.com/ringtailsoftwa... · Posted by u/trj
trj · a year ago
I use SSH every day. I login to remote machines, push code changes to github and scp files. Like many programmers, I know how to use SSH to get things done but had never looked deeper to understand the protocol itself.

I recently wrote a minimal SSH client to help demystify the protocol. In this post, I'll explain some of the core concepts to help anyone else doing the same. This will be a 10,000ft overview with references to some interesting parts - not an implementation guide.

u/trj

KarmaCake day99October 3, 2013View Original