3 ms·
Interesting approach! The writeup is really detailed, and I think it is a very solid concept. The only downside is the slowdown due to the entire c->wasm->c tra
by crote 3y ago
Interesting approach! The writeup is really detailed, and I think it is a very solid concept. The only downside is the slowdown due to the entire c->wasm->c translation and the need to essentially virtualize every single memory access. And it doesn't really protect against bugs in the translation layer, of course.
I noticed that the reference manual[0] of the MCU used also mentions a "firewall", which can be used to essentially create a "user mode" and "kernel mode" separation in both code and memory, with a well-defined "syscall" entry point. It would be neat to compare the impact of software vs hardware privilege separation.
[0]: https://www.st.com/resource/en/reference_manual/rm0394-stm32l41xxx42xxx43xxx44xxx45xxx46xxx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf https://www.st.com/resource/en/reference_manual/rm0394-stm32...
- bkettle 3y agoAgreed. One benefit of the SFI-based approach over typical approaches that leverage hardware like MPUs or this firewall is that we can have arbitrarily many privilege domains. For the security key we only have three (Trusted, USB, and FIDO2 lib) but there is nothing stopping us from adding more to get finer-grained privilege separation with each module having a smaller set of permissions. It’s possible to build multiple domains on top of these hardware mechanisms, but adds reconfiguration complexity at every context switch that we are able to avoid (at the cost of general runtime overhead). It would definitely be interesting to compare the two approaches. Another approach adds hardware specifically for this kind of sandboxing: a paper from earlier this year [1] implements an extension to x86 that adds hardware support for Wasm-style SFI. It could be interesting to see how this can apply to the embedded context where resources are more limited. One nice thing about embedded stuff like this, though, is that we are dealing with human time scales and fairly simple operations—-there was a lot of room for slowdown without becoming unreasonable. 1: https://dl.acm.org/doi/pdf/10.1145/3582016.3582023 https://dl.acm.org/doi/pdf/10.1145/3582016.3582023