patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Spectrum OS Development <devel@spectrum-os.org>
Cc: Alyssa Ross <hi@alyssa.is>, Demi Marie Obenour <demiobenour@gmail.com>
Subject: [PATCH] host/rootfs: Sandbox Weston (almost) for real
Date: Fri, 05 Dec 2025 10:54:41 -0500	[thread overview]
Message-ID: <20251205-sandbox-weston-v1-1-c55b2d9cb8d2@gmail.com> (raw)

The "almost" is because of the need for Weston to create
/run/user/0/wayland-1.  This can be fixed by passing the listening
socket into Weston.  Also Weston still runs as root and there is no
seccomp filtering or MAC.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
 host/rootfs/image/etc/s6-rc/weston/run | 54 ++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/host/rootfs/image/etc/s6-rc/weston/run b/host/rootfs/image/etc/s6-rc/weston/run
index 251f5da4597a916c4e46a0dfd64cec261d519d23..87579d1bddb4c191dda0c1659f88e74c178d13a1 100644
--- a/host/rootfs/image/etc/s6-rc/weston/run
+++ b/host/rootfs/image/etc/s6-rc/weston/run
@@ -18,5 +18,55 @@ redirfd -r 0 /dev/tty1
 importas -i home HOME
 cd $home
 if { udevadm wait /dev/dri/card0 }
-unshare --cgroup --ipc --net --uts
-weston
+bwrap
+  # no --unshare-net, breaks udev hotplug
+  --unshare-ipc
+  --unshare-uts
+  --unshare-cgroup
+  --cap-add CAP_SYS_TTY_CONFIG
+  --dev-bind /dev /dev
+  --bind /run /run
+  --ro-bind /etc /etc
+  --ro-bind /nix /nix
+  --ro-bind /usr /usr
+  --ro-bind /lib /lib
+  --ro-bind /bin /bin
+  --ro-bind /sbin /sbin
+  # For /run/seatd.sock
+  --tmpfs /run
+  # For OpenGL/Vulkan/etc
+  --ro-bind /run/opengl-driver /run/opengl-driver
+  # For udev
+  --ro-bind /run/udev /run/udev
+  --tmpfs /tmp
+  --tmpfs /dev/shm
+  # Filtered /proc (without nasty stuff)
+  --proc /proc
+  --ro-bind /proc/sys /proc/sys
+  --tmpfs /proc/scsi
+  --remount-ro /proc/scsi
+  --tmpfs /proc/acpi
+  --remount-ro /proc/acpi
+  --tmpfs /proc/fs
+  --remount-ro /proc/fs
+  --tmpfs /proc/irq
+  --remount-ro /proc/irq
+  --ro-bind /dev/null /proc/timer_list
+  --ro-bind /dev/null /proc/kcore
+  --ro-bind /dev/null /proc/kallsyms
+  --ro-bind /dev/null /proc/sysrq-trigger
+  --ro-bind /sys /sys
+  --dev /dev
+  # GPUs
+  --dev-bind /dev/dri /dev/dri
+  # Input devices
+  --dev-bind /dev/input /dev/input
+  # Virtual consoles
+  --dev-bind /dev/tty1 /dev/tty1
+  --dev-bind /dev/tty0 /dev/tty0
+  # Kernel console
+  --dev-bind /dev/console /dev/console
+  # So that Weston can create its listening socket
+  --bind /run/user/0 /run/user/0
+  --
+/usr/bin/weston

---
base-commit: 92e219e7c08c479d216a46d2736ea9d229ff034d
change-id: 20251205-sandbox-weston-7bb8c5e0b55f

-- 
Sincerely,
Demi Marie Obenour (she/her/hers)


             reply	other threads:[~2025-12-05 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 15:54 Demi Marie Obenour [this message]
2025-12-16 12:11 ` [PATCH] host/rootfs: Sandbox Weston (almost) for real Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251205-sandbox-weston-v1-1-c55b2d9cb8d2@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).