patches and low-level development discussion
 help / color / mirror / code / Atom feed
* Sandboxing strategy
@ 2025-09-09  7:57 Demi Marie Obenour
  2025-09-10 15:11 ` Alyssa Ross
  0 siblings, 1 reply; 8+ messages in thread
From: Demi Marie Obenour @ 2025-09-09  7:57 UTC (permalink / raw)
  To: Spectrum OS Development


[-- Attachment #1.1.1: Type: text/plain, Size: 1562 bytes --]

I was thinking about how to sandbox the various per-VM daemons
and came up with the following strategy:

- Each VM gets its own PID and mount namespace and set of user IDs.

- Mount namespace includes /proc, /sys, /dev, and the host rootfs.

- Each service gets its own /tmp and /dev/shm if they are needed at all.

- virtiofsd gets r/w access to the VM private storage.

- IPC namespaces are irrelevant because the kernel is
  built without System V IPC or POSIX message queues.

- Sending signals between services in the namespace is blocked
  by Landlock.  Landlock also blocks ptrace() and other nastiness,
  as well as communication via abstract AF_UNIX sockets.

- Since AF_UNIX abstract sockets between services are blocked by
  Landlock and Spectrum builds without IP or even Ethernet on the
  host there is no need for network namespacing.

- The sandbox manager is PID 1 in the VM's PID namespace.
  When s6 tells it to shut down, it tries to gracefully shut
  down the VM.  After a timeout or once the VM has shut down,
  it exits, and Linux automatically kills all the processes
  and cleans up the mount namespace.

- The sandbox manager uses prctl(PR_SET_PDEATHSIG) to ensure it
  dies if the parent s6 process dies.  This requires s6 to provide
  its own PID to avoid races, but that is easy to implement.

All of this behavior will be hard-coded into C and Rust source code,
so it will be vastly simpler than a generic program that must support
many use-cases.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-09-19 19:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09  7:57 Sandboxing strategy Demi Marie Obenour
2025-09-10 15:11 ` Alyssa Ross
2025-09-10 15:14   ` Alyssa Ross
2025-09-10 20:35   ` Demi Marie Obenour
2025-09-17 11:27     ` Alyssa Ross
2025-09-18  2:34       ` Demi Marie Obenour
2025-09-19 13:17         ` Alyssa Ross
2025-09-19 19:37           ` Demi Marie Obenour

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).