Open ghost opened 3 years ago
I think virtualization is one of the missing pieces of Firejail. It would allow much better system call interception than seccomp (which can't dereference pointers), even very low level operations like filtering of CPU instructions or messing with page tables. Some Spectre-type attacks could be prevented by flushing caches and inserting a random small delay at every system call. This would be too expensive for all applications but maybe acceptable for Firejail. Detection of ROP, JOP or Spectre-class attacks would be awesome. Application checkpoint/restore would be nice too. Windows seems to use VMs to virtualize processes at OS level, so Linux is behind here.
Running runsc or writing OCI config files seems to be way too high level interface. Instead the interface should be a C library with very detailed control. System call intercepting should be done by Firejail, for example gVisor could call a plugin provided by Firejail. gVisor also duplicates sandboxing functions already implemented in Firejail, like network or file system filtering features, but perhaps that can be ignored.
I opened a feature request for gVisor: https://github.com/google/gvisor/issues/5440
gVisor is intriguing because it's a far better sandbox than firejail, bwrap, nsjail or any others. Unfortunately the OCI spec is quite lame, but I think I will use it anyway.
Note that it doesn't appear to implement unix sockets correctly, can't get the x11 or wayland sockets to work even with --fsgofer-host-uds. So it would appear to be restricted to non-graphical applications.
gVisor in contrast to seccomp does not pass any syscalls, it interprets them. Those it can service itself it does, others it services by calling syscalls itself but there is never direct pass-through. Which is far superior isolation to seccomp. It uses seccmp on itself too of course to restrict itself from calling arbitrary syscalls should it be compromised.
gVisor emulates the majority of linux syscalls in userland, providing a respectable sandbox.
gVisor provides a runtime (runsc) capable of running OCI spec containers. https://gvisor.dev/docs/user_guide/quick_start/oci/
It should be possible to either modify gVisor to accept a different interface or to have firejail output an OCI config for an OCI runtime.
gVisor already has something that may be a starting point:
sudo runsc do echo ok